[sr-dev] git:master:e85f33d7: pv: check source for memcpy

Daniel-Constantin Mierla miconda at gmail.com
Fri Nov 19 08:58:02 CET 2021


Module: kamailio
Branch: master
Commit: e85f33d7c827b85634f6fe0377ff9f30b3bc4e84
URL: https://github.com/kamailio/kamailio/commit/e85f33d7c827b85634f6fe0377ff9f30b3bc4e84

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2021-11-19T08:57:25+01:00

pv: check source for memcpy

---

Modified: src/modules/pv/pv_svar.c

---

Diff:  https://github.com/kamailio/kamailio/commit/e85f33d7c827b85634f6fe0377ff9f30b3bc4e84.diff
Patch: https://github.com/kamailio/kamailio/commit/e85f33d7c827b85634f6fe0377ff9f30b3bc4e84.patch

---

diff --git a/src/modules/pv/pv_svar.c b/src/modules/pv/pv_svar.c
index 255f9f2040..f04fa9818b 100644
--- a/src/modules/pv/pv_svar.c
+++ b/src/modules/pv/pv_svar.c
@@ -134,7 +134,9 @@ script_var_t* set_var_value(script_var_t* var, int_str *value, int flags)
 			}
 			var->v.flags |= VAR_VAL_STR;
 		}
-		memcpy(var->v.value.s.s, value->s.s, value->s.len);
+		if(value->s.s) {
+			memcpy(var->v.value.s.s, value->s.s, value->s.len);
+		}
 		var->v.value.s.len = value->s.len;
 		var->v.value.s.s[value->s.len] = '\0';
 	} else {




More information about the sr-dev mailing list