Module: kamailio
Branch: master
Commit: 136071c4a3cd306ef1043b02d1b61ce7d37efa52
URL:
https://github.com/kamailio/kamailio/commit/136071c4a3cd306ef1043b02d1b61ce…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-11-19T08:25:45+01:00
core: re - check source of memcpy
---
Modified: src/core/re.c
---
Diff:
https://github.com/kamailio/kamailio/commit/136071c4a3cd306ef1043b02d1b61ce…
Patch:
https://github.com/kamailio/kamailio/commit/136071c4a3cd306ef1043b02d1b61ce…
---
diff --git a/src/core/re.c b/src/core/re.c
index 4ce18d8c4d..47322284b6 100644
--- a/src/core/re.c
+++ b/src/core/re.c
@@ -339,8 +339,10 @@ static int replace_build(const char* match, int nmatch, regmatch_t*
pmatch,
LM_ERR("Buffer too small\n"); \
goto error; \
} \
- memcpy((dst), (src), (size)); \
- (dst) += (size);
+ if(likely(src)) { \
+ memcpy((dst), (src), (size)); \
+ (dst) += (size); \
+ }
p=se->replacement.s;
end=p+se->replacement.len;