res_fax: Fix out of bounds error in update_modem_bits().
authorRichard Mudgett <rmudgett@digium.com>
Fri, 26 Sep 2014 15:28:39 +0000 (15:28 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Fri, 26 Sep 2014 15:28:39 +0000 (15:28 +0000)
ASTERISK-24357 #close
Reported by: Jeremy Laine
Patches:
      res_fax_bounds.patch (license #6561) patch uploaded by Jeremy Laine
  Modified patch to not use magic numbers.
........

Merged revisions 423979 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 423983 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 423987 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 423992 from http://svn.asterisk.org/svn/asterisk/branches/13

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@424016 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/res_fax.c

index e703e16..247251c 100644 (file)
@@ -809,7 +809,7 @@ static int update_modem_bits(enum ast_fax_modems *bits, const char *value)
                m[i] = NULL;
        } else {
                tok = strtok(v, ", ");
-               while (tok && (i < 5)) {
+               while (tok && i < ARRAY_LEN(m) - 1) {
                        m[i++] = tok;
                        tok = strtok(NULL, ", ");
                }