]> git.deb.at Git - pkg/abook.git/commitdiff
Fixed a possible problem in find() function
authorJaakko Heinonen <jheinonen@users.sourceforge.net>
Fri, 6 Apr 2001 18:08:52 +0000 (18:08 +0000)
committerJaakko Heinonen <jheinonen@users.sourceforge.net>
Fri, 6 Apr 2001 18:08:52 +0000 (18:08 +0000)
database.c

index 1b59311fe17c7a4472466beca077966263df940b..cf02d57c673345d5c6229d6bc1844a6f3c6e746a 100644 (file)
@@ -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();