Browse code

core: re - check source of memcpy

Daniel-Constantin Mierla authored on 19/11/2021 07:25:45
Showing 1 changed files
... ...
@@ -339,8 +339,10 @@ static int replace_build(const char* match, int nmatch, regmatch_t* pmatch,
339 339
 		LM_ERR("Buffer too small\n");			\
340 340
 		goto error;											\
341 341
 	}														\
342
-	memcpy((dst), (src), (size));							\
343
-	(dst) += (size);
342
+	if(likely(src)) {							\
343
+		memcpy((dst), (src), (size));			\
344
+		(dst) += (size);						\
345
+	}
344 346
 
345 347
 	p=se->replacement.s;
346 348
 	end=p+se->replacement.len;