From 2dd75819b174c796ebd7e93602a36305b5346c8f Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Mon, 28 May 2007 14:00:22 +0200 Subject: [PATCH] fix parsing issues in slurp_newsrc Signed-off-by: Pierre Habouzit --- nntp.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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; } -- 2.20.1