From: Jaakko Heinonen Date: Fri, 6 Apr 2001 18:08:52 +0000 (+0000) Subject: Fixed a possible problem in find() function X-Git-Tag: upstream/0.6.1~2^2~388 X-Git-Url: https://git.deb.at/w?a=commitdiff_plain;h=98874514f940049d44ffea0c8f0654b810b795be;hp=3bedb1428115f85dfb75622a0279d67ec3aecdcc;p=pkg%2Fabook.git Fixed a possible problem in find() function --- diff --git a/database.c b/database.c index 1b59311..cf02d57 100644 --- a/database.c +++ b/database.c @@ -414,8 +414,8 @@ void find(int next) { int i; - static char findstr[81]; - char tmp[81]; + static char findstr[MAX_FIELD_LEN]; + char tmp[MAX_FIELD_LEN]; #ifdef DEBUG fprintf(stderr, "find(): findstr = |%s|\n", findstr); @@ -427,7 +427,7 @@ find(int next) } else { clear_statusline(); statusline_addstr("/"); - statusline_getnstr(findstr, 67, 0); + statusline_getnstr(findstr, MAX_FIELD_LEN - 1, 0); strupper(findstr); clear_statusline(); } @@ -437,7 +437,7 @@ find(int next) for( i = (curitem < LAST_ITEM) && next ? curitem+1 : curitem; i < items; i++ ) { - strcpy(tmp, database[i][NAME]); + strncpy(tmp, database[i][NAME], MAX_FIELD_LEN - 1); if( strstr(strupper(tmp), findstr) != NULL ) { curitem = i; refresh_list();