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>
This commit is contained in:
parent
8da91fffea
commit
7464f0587b
@ -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…
Reference in New Issue
Block a user