mirror of
https://github.com/VARCem/PDCurses.git
synced 2026-09-25 00:05:16 +00:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user