]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
Add NULL check after strdup
authorpcarana <pc.moreno2099@gmail.com>
Wed, 20 Mar 2019 23:22:24 +0000 (17:22 -0600)
committerpcarana <pc.moreno2099@gmail.com>
Wed, 20 Mar 2019 23:22:24 +0000 (17:22 -0600)
src/configuration.c

index 31925932d000d548494fad40e903c3215e0e69e1..cf9cd54eb868faa3dd967e87c91b8154dd091fcc 100644 (file)
@@ -191,8 +191,13 @@ handle_json(json_t *root)
                            DEFAULT_VRPS_LOCATION, &vrps_location);
                if (error)
                        return error;
-               /* TODO (review) check NULL */
+
                config.vrps_location = strdup(vrps_location);
+               if (config.vrps_location == NULL) {
+                       err(errno, "'%s' couldn't be allocated.",
+                                       OPTNAME_VRPS_LOCATION);
+                       return errno;
+               }
 
                /*
                 * RFC 6810 and 8210:
@@ -315,6 +320,11 @@ init_addrinfo(char const *hostname, char const *service)
 
        /* TODO (review) check NULL */
        config.port = strdup(service);
+       if (config.port == NULL) {
+               err(errno, "'%s' couldn't be allocated.", OPTNAME_LISTEN_PORT);
+               return errno;
+       }
+
        return 0;
 }