Module: kamailio
Branch: master
Commit: 43871e4a81afc2ee1ce43b8224809dc11fe61c37
URL:
https://github.com/kamailio/kamailio/commit/43871e4a81afc2ee1ce43b8224809dc…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: GitHub <noreply(a)github.com>
Date: 2016-10-28T12:04:45+02:00
Merge pull request #832 from zecke/pv/use-memcpy-for-bytes
pv: Use memcpy to copy len bytes instead of strcpy
---
Modified: modules/pv/pv_svar.c
---
Diff:
https://github.com/kamailio/kamailio/commit/43871e4a81afc2ee1ce43b8224809dc…
Patch:
https://github.com/kamailio/kamailio/commit/43871e4a81afc2ee1ce43b8224809dc…
---
diff --git a/modules/pv/pv_svar.c b/modules/pv/pv_svar.c
index 3b4c710..ae22db1 100644
--- a/modules/pv/pv_svar.c
+++ b/modules/pv/pv_svar.c
@@ -70,7 +70,7 @@ script_var_t* add_var(str *name, int vtype)
return 0;
}
it->name.len = name->len;
- strncpy(it->name.s, name->s, name->len);
+ memcpy(it->name.s, name->s, name->len);
it->name.s[it->name.len] = '\0';
if(vtype==VAR_TYPE_NULL) {
@@ -133,7 +133,7 @@ script_var_t* set_var_value(script_var_t* var, int_str *value, int
flags)
}
var->v.flags |= VAR_VAL_STR;
}
- strncpy(var->v.value.s.s, value->s.s, value->s.len);
+ 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 {