fixed NULL dereference

This commit is contained in:
Frank Morgner 2018-08-23 09:51:04 +02:00
parent 45f407c021
commit 67fbf15741
1 changed files with 7 additions and 5 deletions

View File

@ -178,11 +178,13 @@ sc_ctx_win32_get_config_value(const char *name_env,
if (name_env) { if (name_env) {
char *value = value = getenv(name_env); char *value = value = getenv(name_env);
if (strlen(value) < *out_len) if (value) {
return SC_ERROR_NOT_ENOUGH_MEMORY; if (strlen(value) < *out_len)
memcpy(out, value, strlen(value)); return SC_ERROR_NOT_ENOUGH_MEMORY;
*out_len = strlen(value); memcpy(out, value, strlen(value));
return SC_SUCCESS; *out_len = strlen(value);
return SC_SUCCESS;
}
} }
if (!name_reg) if (!name_reg)