Rewrite split_lines() to operate safely

PR:             62694
Submitted by:   moulin p <moulin.p@calyopea.com>
This commit is contained in:
ache 2004-04-25 19:56:50 +00:00
parent 05ba732e14
commit a7c84134a6

View File

@ -153,9 +153,13 @@ split_lines(char *p, const char *plim)
{
int i;
for (i = 0; p < plim; i++) {
p = strchr(p, '\n');
*p++ = '\0';
i = 0;
while (p < plim) {
if (*p == '\n') {
*p = '\0';
i++;
}
p++;
}
return (i);
}