Browse Source

check-qdict: Fix possible crash

This warning is reported by cppcheck:

check-qdict.c:270: warning: scanf without field width limits can crash with huge input data

Fix it by limiting the field widths to 127 (both key and value take
127 characters + a terminating '\0' byte).

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
remotes/github/stable-0.15
Stefan Weil 15 years ago
committed by Aurelien Jarno
parent
commit
7464f0587b
  1. 3
      check-qdict.c

3
check-qdict.c

@ -267,8 +267,9 @@ static QString *read_line(FILE *file, char *key)
{
char value[128];
if (fscanf(file, "%s%s", key, value) == EOF)
if (fscanf(file, "%127s%127s", key, value) == EOF) {
return NULL;
}
remove_dots(key);
return qstring_from_str(value);
}

Loading…
Cancel
Save