mirror of
https://review.haiku-os.org/buildtools
synced 2024-11-23 07:18:49 +01:00
jam: jcache: read_file(): fail when encountering too long lines
For its input files jam uses a buffer of 512 chars for fgets(). Lines would therefore be split silently after that length, which could lead to "interesting" issues. Now we fail to prevent the situation from going unnoticed.
This commit is contained in:
parent
502f1ff979
commit
531916daa2
@ -444,6 +444,11 @@ read_file(const char *filename, string_list* list)
|
||||
len++;
|
||||
line[len] = '\0';
|
||||
}
|
||||
if ((size_t)len + 1 == sizeof(buffer)) {
|
||||
fprintf(stderr, "error: %s:%d: line too long!\n", filename,
|
||||
list->count + 1);
|
||||
exit(1);
|
||||
}
|
||||
// copy it
|
||||
string = (char*)malloc(len + 1);
|
||||
if (string) {
|
||||
|
Loading…
Reference in New Issue
Block a user