Port dictionary file sanity checks from the head
authoraland <aland>
Wed, 29 Mar 2006 19:56:00 +0000 (19:56 +0000)
committeraland <aland>
Wed, 29 Mar 2006 19:56:00 +0000 (19:56 +0000)
src/lib/dict.c

index 30d2b7d..4d4024e 100644 (file)
@@ -882,6 +882,12 @@ static int my_dict_init(const char *dir, const char *fn,
        }
 
        stat(fn, &statbuf); /* fopen() guarantees this will succeed */
+       if (!S_ISREG(statbuf.st_mode)) {
+               fclose(fp);
+               librad_log("dict_init: Dictionary \"%s\" is not a regular file",
+                          fn);
+               return -1;        
+       }
        dict_stat_add(fn, &statbuf);
 
        /*