Don't dereference NULL.
Also fixed a typo in error string while I was there.
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
if (rc) { fprintf(stderr, "Failed to read config file: %s: %s\n",
filename, strerror(errno));
free(extra_config); return ERROR_FAIL; }
- if (strlen(extra_config)) {
+ if (extra_config && strlen(extra_config)) {
if (config_len > INT_MAX - (strlen(extra_config) + 2 + 1)) {
- fprintf(stderr, "Failed to attach extra configration\n");
+ fprintf(stderr, "Failed to attach extra configuration\n");
exit(1);
}
/* allocate space for the extra config plus two EOLs plus \0 */