diff options
author | Matt Kraai <kraai@debian.org> | 2001-10-18 17:03:59 +0000 |
---|---|---|
committer | Matt Kraai <kraai@debian.org> | 2001-10-18 17:03:59 +0000 |
commit | a7512d74fa64649cdd93602a00046b4ba028cea9 (patch) | |
tree | bca871b9b445bdb0680f940617b0cd5eb4f1ab00 | |
parent | 3dd4f5ed69cb6cfc603cae9c79b93eca89d888cc (diff) | |
download | busybox-a7512d74fa64649cdd93602a00046b4ba028cea9.tar.gz |
Process extra empty lines correctly.
-rw-r--r-- | archival/dpkg.c | 6 | ||||
-rw-r--r-- | dpkg.c | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/archival/dpkg.c b/archival/dpkg.c index 95c8b88cb..d566bfe5b 100644 --- a/archival/dpkg.c +++ b/archival/dpkg.c @@ -769,7 +769,11 @@ void write_status_file(deb_file_t **deb_file) /* Update previously known packages */ while ((control_buffer = fgets_str(old_status_file, "\n\n")) != NULL) { - tmp_string = strstr(control_buffer, "Package:") + 8; + if ((tmp_string = strstr(control_buffer, "Package:")) == NULL) { + continue; + } + + tmp_string += 8; tmp_string += strspn(tmp_string, " \n\t"); package_name = xstrndup(tmp_string, strcspn(tmp_string, "\n\0")); write_flag = FALSE; @@ -769,7 +769,11 @@ void write_status_file(deb_file_t **deb_file) /* Update previously known packages */ while ((control_buffer = fgets_str(old_status_file, "\n\n")) != NULL) { - tmp_string = strstr(control_buffer, "Package:") + 8; + if ((tmp_string = strstr(control_buffer, "Package:")) == NULL) { + continue; + } + + tmp_string += 8; tmp_string += strspn(tmp_string, " \n\t"); package_name = xstrndup(tmp_string, strcspn(tmp_string, "\n\0")); write_flag = FALSE; |