sfeed

Simple RSS and Atom feed parser
git clone https://git.sinitax.com/codemadness/sfeed
Log | Files | Refs | README | LICENSE | Upstream | sfeed.txt

commit ad7fdd4bf80b716ba438e59e66d27bba8e7acefb
parent 3a72c90c2f7348f3e989a8cbe557a99c6de0e026
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sun, 21 Jun 2015 00:20:54 +0200

util: fix parseline crash

Diffstat:
Mutil.c | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/util.c b/util.c @@ -72,6 +72,7 @@ printlink(const char *link, const char *baseurl, FILE *fp) /* read a field-separated line from 'fp', * separated by a character 'separator', * 'fields' is a list of pointer with a maximum size of 'maxfields'. + * 'maxfields' must be > 0. * 'line' buffer is allocated using malloc, 'size' will contain the * allocated buffer size. * returns: amount of fields read or -1 on error. */ @@ -86,7 +87,7 @@ parseline(char **line, size_t *size, char **fields, return -1; for(prev = *line, i = 0; - (s = strchr(prev, separator)) && i <= maxfields; + (s = strchr(prev, separator)) && i < maxfields - 1; i++) { *s = '\0'; fields[i] = prev;