summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-05-14 12:18:00 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-05-14 12:18:00 +0100
commit344a6acc364250c37ca4aa3ea28589882fdf6999 (patch)
treed96d7cb77389fa19964a6ac3dfc83d40f7f06f95 /src
parent4c52048f0990e6a89967ed0bb67884fc46074dcd (diff)
e env var config fialog - fix potential null access
coverity complained. it's right. fix CID 1428807
Diffstat (limited to 'src')
-rw-r--r--src/modules/conf_paths/e_int_config_env.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/modules/conf_paths/e_int_config_env.c b/src/modules/conf_paths/e_int_config_env.c
index bfcfa939c..96348f066 100644
--- a/src/modules/conf_paths/e_int_config_env.c
+++ b/src/modules/conf_paths/e_int_config_env.c
@@ -150,17 +150,24 @@ _sel_cb(void *data)
150static const char * 150static const char *
151_env_text(E_Config_Env_Var *evr) 151_env_text(E_Config_Env_Var *evr)
152{ 152{
153 static Eina_Slstr *text; 153 static Eina_Slstr *text = "";
154 char *val; 154 char *val;
155 155
156 val = strndup(evr->val, 64); 156 if (evr->val) val = strndup(evr->val, 64);
157 else val = strdup("");
157 158
158 if (strlen(evr->val) > 64) 159 if (val)
159 text = eina_slstr_printf("%s=%s...", evr->var, val); 160 {
161 if (strlen(evr->val) > 64)
162 text = eina_slstr_printf("%s=%s...", evr->var, val);
163 else
164 text = eina_slstr_printf("%s=%s", evr->var, val);
165 free(val);
166 }
160 else 167 else
161 text = eina_slstr_printf("%s=%s", evr->var, val); 168 {
162 169 text = eina_slstr_printf("%s", evr->var);
163 free(val); 170 }
164 171
165 return text; 172 return text;
166} 173}