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)));
|
line_number, filename)));
|
||||||
|
|
||||||
/* Strip trailing linebreak from rawline */
|
/* Strip trailing linebreak from rawline */
|
||||||
while (rawline[strlen(rawline) - 1] == '\n' ||
|
lineptr = rawline + strlen(rawline) - 1;
|
||||||
rawline[strlen(rawline) - 1] == '\r')
|
while (lineptr >= rawline && (*lineptr == '\n' || *lineptr == '\r'))
|
||||||
rawline[strlen(rawline) - 1] = '\0';
|
*lineptr-- = '\0';
|
||||||
|
|
||||||
lineptr = rawline;
|
lineptr = rawline;
|
||||||
while (strlen(lineptr) > 0)
|
while (strlen(lineptr) > 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user