[BusyBox] [PATCH] Ignore extra empty lines in fgets_str
kraai at lafn.org
kraai at lafn.org
Wed Oct 17 23:40:51 UTC 2001
> Hi,
>
> I've discovered that dpkg exits with a SEGV if the status file has extra
> empty lines at the end of the file. They should rather be ignored than
> causing a SEGV. This small patch in fgets_str() takes care of the problem.
>
> -Stefan
>
> --- libbb/fgets_str.c Wed Jun 13 00:34:03 2001
> +++ libbb/fgets_str.c Wed Oct 17 12:35:28 2001
> @@ -55,7 +55,7 @@ char *fgets_str(FILE *file, const char *
> break;
> }
> }
> - if (idx == 0) {
> + if (idx == 0 || linebuf[0] == '\n') {
> return NULL;
> }
> linebuf[idx] = '\0';
I can't imagine that this is the correct solution. If the first
character of the string we are returning is a newline, then return
NULL? This bug should be fixed in dpkg, not fgets_str.
Matt
---------------------------------------------
This message was sent using Endymion MailMan.
http://www.endymion.com/products/mailman/
More information about the busybox
mailing list