X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Fview.c;h=3925b842c47d1fb8f2a8e37e6b8d3612e3f4252c;hp=9834e44415a7f496142d53133ba2176c7267ab70;hb=8f527f87c0b979d9c2598ef5c3394463af288468;hpb=4c309ad3b124eff80aa6b54018b5cc9f1e3d116d diff --git a/test/view.c b/test/view.c index 9834e444..3925b842 100644 --- a/test/view.c +++ b/test/view.c @@ -50,7 +50,7 @@ * scroll operation worked, and the refresh() code only had to do a * partial repaint. * - * $Id: view.c,v 1.67 2008/01/19 21:01:21 tom Exp $ + * $Id: view.c,v 1.68 2008/08/03 11:37:07 tom Exp $ */ #include @@ -238,7 +238,8 @@ main(int argc, char *argv[]) CATCHALL(SIG_IGN); break; case 'n': - if ((MAXLINES = atoi(optarg)) < 1) + if ((MAXLINES = atoi(optarg)) < 1 || + (MAXLINES + 2) <= 1) usage(); break; #if CAN_RESIZE @@ -508,9 +509,10 @@ show_all(const char *tag) time_t this_time; #if CAN_RESIZE - sprintf(temp, "%s (%3dx%3d) col %d ", tag, LINES, COLS, shift); + sprintf(temp, "%.20s (%3dx%3d) col %d ", tag, LINES, COLS, shift); i = strlen(temp); - sprintf(temp + i, "view %.*s", (int) (sizeof(temp) - 7 - i), fname); + if ((i + 7) < (int) sizeof(temp)) + sprintf(temp + i, "view %.*s", (int) (sizeof(temp) - 7 - i), fname); #else (void) tag; sprintf(temp, "view %.*s", (int) sizeof(temp) - 7, fname);