mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-28 16:43:09 +00:00
Rewrite split_lines() to operate safely
PR: 62694 Submitted by: moulin p <moulin.p@calyopea.com>
This commit is contained in:
parent
a50d1c0876
commit
28aec5a68c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=128650
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user