mirror of
https://github.com/postgres/postgres.git
synced 2025-04-22 23:02:54 +03:00
Avoid reading below the start of a stack variable in tokenize_file().
We would wrongly overwrite the prior stack byte if it happened to contain '\n' or '\r'. New in 9.3, so no back-patch.
This commit is contained in:
parent
813895e4ac
commit
3a5d0c5533
@ -411,9 +411,9 @@ tokenize_file(const char *filename, FILE *file,
|
||||
line_number, filename)));
|
||||
|
||||
/* Strip trailing linebreak from rawline */
|
||||
while (rawline[strlen(rawline) - 1] == '\n' ||
|
||||
rawline[strlen(rawline) - 1] == '\r')
|
||||
rawline[strlen(rawline) - 1] = '\0';
|
||||
lineptr = rawline + strlen(rawline) - 1;
|
||||
while (lineptr >= rawline && (*lineptr == '\n' || *lineptr == '\r'))
|
||||
*lineptr-- = '\0';
|
||||
|
||||
lineptr = rawline;
|
||||
while (strlen(lineptr) > 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user