mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-04 09:09:56 +00:00
Fix a segfault which occurs when it gets an empty input line.
Closes PR bin/1153 Reviewed by: smpatel Submitted by: Matthew C. Mead (mmead@Glock.COM)
This commit is contained in:
parent
91e2481238
commit
003aaef883
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=15344
@ -172,7 +172,6 @@ fmt(fi)
|
||||
*cp++ = c;
|
||||
c = getc(fi);
|
||||
}
|
||||
*cp = '\0';
|
||||
|
||||
/*
|
||||
* Toss anything remaining on the input line.
|
||||
@ -180,6 +179,14 @@ fmt(fi)
|
||||
while (c != '\n' && c != EOF)
|
||||
c = getc(fi);
|
||||
|
||||
if (cp != NULL) {
|
||||
*cp = '\0';
|
||||
} else {
|
||||
putchar('\n');
|
||||
c = getc(fi);
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Expand tabs on the way to canonb.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user