]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
try to shut up coverity
authorAlan T. DeKok <aland@freeradius.org>
Sun, 17 Apr 2022 05:59:46 +0000 (01:59 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 20 Apr 2022 13:13:59 +0000 (09:13 -0400)
which thinks that fr_token_t can be between 0..63, instead of
0..48?

src/lib/util/token.c

index e45abcb899fa0a76162effc4b56be8134f36bc66..b330eaacefcae6b40138a08751ac47ecaf358fff 100644 (file)
@@ -256,6 +256,12 @@ static fr_token_t getthing(char const **ptr, char *buf, int buflen, bool tok,
                                strcpy(buf, tokenlist[i].name.str);
                                p += tokenlist[i].name.len;
 
+                               /*
+                                *      Try to shut up Coverity, which claims fr_token_t can be between 0..63, not
+                                *      0..48???
+                                */
+                               if ((tokenlist[i].value < 0) || (tokenlist[i].value >= T_TOKEN_LAST)) return T_INVALID;
+
                                token = tokenlist[i].value;
                                goto done;
                        }