From: Pierre Habouzit Date: Mon, 28 May 2007 12:00:22 +0000 (+0200) Subject: fix parsing issues in slurp_newsrc X-Git-Url: http://git.madism.org/?a=commitdiff_plain;h=2dd75819b174c796ebd7e93602a36305b5346c8f;p=apps%2Fmadmutt.git fix parsing issues in slurp_newsrc Signed-off-by: Pierre Habouzit --- diff --git a/nntp.c b/nntp.c index a533933..d3bf60f 100644 --- a/nntp.c +++ b/nntp.c @@ -52,7 +52,7 @@ static void mutt_newsgroup_stat(nntp_data_t *data) } } -static int nntp_parse_newsrc_line(nntp_server_t * news, const char *line) +static int nntp_parse_newsrc_line(nntp_server_t *news, const char *line) { nntp_data_t *data; char group[LONG_STRING]; @@ -86,18 +86,19 @@ static int nntp_parse_newsrc_line(nntp_server_t * news, const char *line) data->entries = p_new(NEWSRC_ENTRY, x * 2); data->max = x * 2; data->subscribed = (*p++ == ':'); + p = skipspaces(p); for (x = 0; *p; p++) { - p = skipspaces(p); data->entries[x].first = strtol(p, (char **)&p, 10); - p = skipspaces(p); + p += strcspn(p, "-,"); if (*p == '-') { + if (!*p) + break; data->entries[x].last = strtol(p + 1, (char **)&p, 10); } else { data->entries[x].last = data->entries[x].first; + p = strchrnul(p, ','); } - - p = strchrnul(p, ','); x += data->entries[x].last != 0; }