X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/5dd6771b28c257af405d7248639ed0e3bcdce38b..3b6be5607a251a3a793e97382e251ce66ea2bca0:/sbr/m_convert.c diff --git a/sbr/m_convert.c b/sbr/m_convert.c index 1696190c..496978ee 100644 --- a/sbr/m_convert.c +++ b/sbr/m_convert.c @@ -181,6 +181,18 @@ single: * check if message is in-range and exists. */ if (mp->msgflags & ALLOW_NEW) { + /* + * We can get into a case where the "cur" sequence is way out + * of range, and because it's allowed to not exist (think + * of "rmm; next") it doesn't get checked to make sure it's + * within the range of messages in seq_init(). So if our + * desired sequence is out of range of the allocated folder + * limits simply reallocate the folder so it's within range. + */ + if (first < mp->lowoff || first > mp->hghoff) + mp = folder_realloc(mp, first < mp->lowoff ? first : mp->lowoff, + first > mp->hghoff ? first : mp->hghoff); + set_select_empty (mp, first); } else { if (first > mp->hghmsg @@ -263,10 +275,10 @@ m_conv (struct msgs *mp, char *str, int call) #ifdef LOCALE /* doesn't enforce lower case */ for (bp = buf; (isalpha(*cp) || *cp == '.') - && (bp - buf < sizeof(buf) - 1); ) + && (bp - buf < (int) sizeof(buf) - 1); ) #else for (bp = buf; ((*cp >= 'a' && *cp <= 'z') || *cp == '.') - && (bp - buf < sizeof(buf) - 1); ) + && (bp - buf < (int) sizeof(buf) - 1); ) #endif /* LOCALE */ { *bp++ = *cp++;