diff options
author | subrata_modak <subrata_modak> | 2009-01-19 09:05:34 +0000 |
---|---|---|
committer | subrata_modak <subrata_modak> | 2009-01-19 09:05:34 +0000 |
commit | 679591c589db8a29d771bb70a3895796cda9fa1e (patch) | |
tree | e3b47e85e759bc470781a2837ed8fcfb97d00595 /pan | |
parent | 92dc47791b89f5584d359eb776418b1f0104452b (diff) |
This patch fixes a segfault of pan, when the command file doesn't end with a newline. Signed-Off-By: Jiri Palecek <jpalecek@web.de>.
Diffstat (limited to 'pan')
-rw-r--r-- | pan/pan.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -49,7 +49,7 @@ * - added option to create a command file with all failed tests. * */ -/* $Id: pan.c,v 1.28 2008/11/11 05:15:52 subrata_modak Exp $ */ +/* $Id: pan.c,v 1.29 2009/01/19 09:05:34 subrata_modak Exp $ */ #include <errno.h> #include <string.h> @@ -1031,11 +1031,11 @@ get_collection(char *file, int optind, int argc, char **argv) head = p = n = NULL; a = b = buf; - while (*b != '\0') { + while (a) { /* set b to the start of the next line and add a NULL character * to separate the two lines */ if ((b = strchr(a, '\n')) != NULL) - *b = '\0'; + *b++ = '\0'; /* If this is line isn't a comment */ if ((*a != '#') && (*a != '\0') && (*a != ' ')) { @@ -1056,8 +1056,7 @@ get_collection(char *file, int optind, int argc, char **argv) p = n; coll->cnt++; } - a += strlen(a) + 1; - b = a; + a = b; } free(buf); |