Bounds-checking for the trailing-spaces strip (oops). I'm going back and

forth on the whole thing... it's clear to me that the real intent of the
standard is just that the labels not be returned in their padded or
justified form; spaces passed in by the user need not be covered, and
perhaps should not be.
This commit is contained in:
William McBrine
2007-04-21 01:52:53 +00:00
parent 229d5e4292
commit 46037061b0

View File

@@ -14,7 +14,7 @@
#include <curspriv.h>
#include <stdlib.h>
RCSID("$Id: slk.c,v 1.50 2007/04/19 18:03:16 wmcbrine Exp $");
RCSID("$Id: slk.c,v 1.51 2007/04/21 01:52:53 wmcbrine Exp $");
/*man-start**************************************************************
@@ -255,7 +255,7 @@ int slk_set(int labnum, const char *label, int justify)
/* Drop trailing spaces */
while (label[i + j - 1] == ' ')
while ((i + j) && (label[i + j - 1] == ' '))
i--;
slk[labnum].label[i] = 0;
@@ -618,7 +618,7 @@ int slk_wset(int labnum, const wchar_t *label, int justify)
/* Drop trailing spaces */
while (label[i + j - 1] == L' ')
while ((i + j) && (label[i + j - 1] == L' '))
i--;
slk[labnum].label[i] = 0;