Check for more parse errors when reading dicts. Bug found by Coverity
authorAlan T. DeKok <aland@freeradius.org>
Thu, 6 Sep 2012 09:32:16 +0000 (11:32 +0200)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 6 Sep 2012 09:33:25 +0000 (11:33 +0200)
src/lib/dict.c

index d5cae2d..e225451 100644 (file)
@@ -1661,6 +1661,12 @@ static int process_vendor(const char* fn, const int line, char **argv,
                length = (int) (p[2] - '0');
 
                if (p[3] == ',') {
+                       if (!p[4]) {
+                               fr_strerror_printf("dict_init: %s[%d]: Invalid format for VENDOR.  Expected text like \"1,1\", got \"%s\"",
+                                  fn, line, p);
+                               return -1;
+                       }
+
                        if ((p[4] != 'c') ||
                            (p[5] != '\0')) {
                                fr_strerror_printf("dict_init: %s[%d]: Invalid format for VENDOR.  Expected text like \"1,1\", got \"%s\"",