mirror of
https://review.haiku-os.org/buildtools
synced 2026-02-04 07:53:14 +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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user