We would wrongly overwrite the prior stack byte if it happened to
contain '\n' or '\r'. New in 9.3, so no back-patch.
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)