X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/5dd6771b28c257af405d7248639ed0e3bcdce38b..c576ad2674c37a1c63f004c71049998f38854c64:/sbr/seq_list.c diff --git a/sbr/seq_list.c b/sbr/seq_list.c index b64e8cd8..b7ed5707 100644 --- a/sbr/seq_list.c +++ b/sbr/seq_list.c @@ -1,6 +1,4 @@ - -/* - * seq_list.c -- Get all messages in a sequence and return them +/* seq_list.c -- Get all messages in a sequence and return them * -- as a space separated list of message ranges. * * This code is Copyright (c) 2002, by the authors of nmh. See the @@ -39,10 +37,10 @@ seq_list(struct msgs *mp, char *seqname) */ if (!strcmp (current, seqname)) { if (mp->curmsg) { - sprintf(buffer, "%s", m_name(mp->curmsg)); - return (buffer); - } else - return (NULL); + snprintf(buffer, len, "%s", m_name(mp->curmsg)); + return buffer; + } + return NULL; } /* If the folder is empty, just return NULL */ @@ -85,7 +83,7 @@ seq_list(struct msgs *mp, char *seqname) if (bp > buffer) *bp++ = ' '; - sprintf(bp, "%s", m_name(i)); + strcpy(bp, m_name(i)); bp += strlen(bp); j = i; /* Remember beginning of message range */ @@ -97,9 +95,10 @@ seq_list(struct msgs *mp, char *seqname) ; if (i - j > 1) { - sprintf(bp, "-%s", m_name(i - 1)); + *bp++ = '-'; + strcpy(bp, m_name(i - 1)); bp += strlen(bp); } } - return (bp > buffer? buffer : NULL); + return bp > buffer ? buffer : NULL; }