Browse code

pv: check source for memcpy

Daniel-Constantin Mierla authored on 19/11/2021 07:57:25
Showing 1 changed files
... ...
@@ -134,7 +134,9 @@ script_var_t* set_var_value(script_var_t* var, int_str *value, int flags)
134 134
 			}
135 135
 			var->v.flags |= VAR_VAL_STR;
136 136
 		}
137
-		memcpy(var->v.value.s.s, value->s.s, value->s.len);
137
+		if(value->s.s) {
138
+			memcpy(var->v.value.s.s, value->s.s, value->s.len);
139
+		}
138 140
 		var->v.value.s.len = value->s.len;
139 141
 		var->v.value.s.s[value->s.len] = '\0';
140 142
 	} else {