Fix a buffer overrun in the parsing of the searchpaths, and check the return

values of some curses functions I overlooked.
Pointed out by Brett Lymn in private email.
This commit is contained in:
garbled 2001-01-14 21:23:23 +00:00
parent da57125f23
commit 3c1becf72b
3 changed files with 13 additions and 4 deletions

View File

@ -20,6 +20,8 @@ $set 1 errors
19 No menu hierchy found.
20 Bad keybinding
21 Bad keyword in config file
22 Cannot initialize curses
23 failed to allocate bottomhelp window
$set 2 labels
1 F1=Help
2 F2=Refresh

View File

@ -1,4 +1,4 @@
/* $NetBSD: blabel.c,v 1.7 2001/01/10 10:00:29 garbled Exp $ */
/* $NetBSD: blabel.c,v 1.8 2001/01/14 21:23:23 garbled Exp $ */
/*
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -80,6 +80,9 @@ bottom_help(int type)
label[i] = strdup(keylabel[i]);
labelwin = subwin(stdscr, 2, ws.ws_col, ws.ws_row-2, 0);
if (labelwin == NULL)
bailout("%s", catgets(catalog, 1, 23,
"failed to allocate bottomhelp window"));
wattron(labelwin, A_BOLD);
for (i=0,j=0; i < 10; i+=2, j+=17)

View File

@ -1,4 +1,4 @@
/* $NetBSD: sushi.c,v 1.6 2001/01/10 10:00:29 garbled Exp $ */
/* $NetBSD: sushi.c,v 1.7 2001/01/14 21:23:23 garbled Exp $ */
/*
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -105,7 +105,10 @@ main(int argc, char **argv)
}
}
initscr();
if (initscr() == NULL)
bailout("%s", catgets(catalog, 1, 22,
"Cannot initialize curses"));
cdkscreen = initCDKScreen(stdscr);
ioctl(0, TIOCGWINSZ, &ws);
@ -242,7 +245,8 @@ parse_config(void)
if (searchpaths[i] == NULL)
bailout("malloc: %s", strerror(errno));
if (getenv("HOME") != NULL) {
searchpaths[i] = strcat(getenv("HOME"), "/sushi");
strcpy(searchpaths[i], getenv("HOME"));
strcat(searchpaths[i], "/sushi");
i++;
}
searchpaths[i] = NULL;