Module: kamailio
Branch: master
Commit: 2531dd069bc76f945c5c19253e35fe8b1ef9ed15
URL: https://github.com/kamailio/kamailio/commit/2531dd069bc76f945c5c19253e35fe8…
Author: Holger Hans Peter Freyther <holger(a)moiji-mobile.com>
Committer: Holger Hans Peter Freyther <holger(a)moiji-mobile.com>
Date: 2016-10-25T23:01:14+02:00
pv: Use memcpy to copy len bytes instead of strcpy
The sipcapture plugin stores bytes with VAR_VAL_STR and when
copying the data it would end up being truncated. Use memcpy
instead of strncpy and assume that the original string already
has the NUL termination (or not as with the hep plugin).
Config example:
$var(payload) = hep(0x00f)
---
Modified: modules/pv/pv_svar.c
---
Diff: https://github.com/kamailio/kamailio/commit/2531dd069bc76f945c5c19253e35fe8…
Patch: https://github.com/kamailio/kamailio/commit/2531dd069bc76f945c5c19253e35fe8…
---
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 {
Hi,
I am using Kamailio v4.4.2 revision 892ad6 on Debian wheezy 32bit platform.
The machine has public IPv6 and IPv4 addresses and Kamailio is listening on
both of them.
The problem is that kamailio pseudo variables such as $si, $du, $ct etc.
when contain an IPv6 address, they are not enclosed in square brackets i.e.
"[" and "]". Which creates many problems in writing route script
(kamailio.cfg) and I have to manually check for IPv6 address and if matched
add these square brackets.
For example,
$si returns 2A01:X35:2X71:X02:490X:DDF:61X5:B5X1 but it should return
[2A01:X35:2X71:X02:490X:DDF:61X5:B5X1] instead.
similarly,
$du returns sip:2A01:X35:2X71:X02:490X:DDF:61X5:B5X1:35670;transport=ws
which fails and gives this error,
ERROR: tm [ut.h:254]: uri2dst2(): ERROR: uri2dst: bad_uri:
sip:2A01:X35:2X71:X02:490X:DDF:61X5:B5X1:35670;transport=ws
it should instead return,
sip:[2A01:X35:2X71:X02:490X:DDF:61X5:B5X1]:35670;transport=ws
and so on.
Can we have these brackets for IPv6 addresses everywhere by default? This
will make script writer's life a lot easier.
Thank you.
Even with
```
commit b29217e8036ead0d09c52616000d6b68d4512f86
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Thu Sep 15 19:33:04 2016 +0200
auth_identity: still use ASN1_STRING_data() for libssl < v1.1.0
- from libssl v1.1.0, ASN1_STRING_data() is deprecated, but before it
doesn't exist
- reported by Victor Seva, GH #685
(cherry picked from commit 8a46f415fb13b76fa3b071eecd7dc0401f99759e)
commit 0f2a129e4f1790f8d6502ac224b480d60126fb09
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Thu Sep 15 16:30:30 2016 +0200
auth_identity: switched to use pointer of X509_STORE_CTX
- starting with libssl 1.1.0 the size of X509_STORE_CTX is not known at
compile time, throwing error:
error: storage size of 'ca_ctx' isn't known
X509_STORE_CTX ca_ctx;
- reported by Victor Seva, GH #685
(cherry picked from commit 46f0f1c0f492c45c1b1bbcfd4a0cc63eb56480ea)
```
```
apt-cache policy libssl-dev
libssl-dev:
Installed: 1.1.0b-1
Candidate: 1.1.0b-1
Version table:
*** 1.1.0b-1 100
100 /var/lib/dpkg/status
```
```
every-module group_include=ktls
Makefile:56: modules.lst: No such file or directory
Makefile:107: config.mak: No such file or directory
target architecture <x86_64>, host architecture <x86_64>
making config...
saving modules list...
CC (gcc) [M auth_identity.so] auth_http.o
CC (gcc) [M auth_identity.so] auth_hdrs.o
CC (gcc) [M auth_identity.so] auth_tables.o
CC (gcc) [M auth_identity.so] auth_identity.o
CC (gcc) [M auth_identity.so] auth_crypt.o
CC (gcc) [M auth_identity.so] auth_dynstr.o
LD (gcc) [M auth_identity.so] auth_identity.so
CC (gcc) [M crypto.so] crypto_uuid.o
CC (gcc) [M crypto.so] crypto_mod.o
crypto_mod.c: In function 'w_crypto_aes_encrypt':
crypto_mod.c:161:17: error: storage size of 'en' isn't known
EVP_CIPHER_CTX en;
^~
crypto_mod.c:161:17: warning: unused variable 'en' [-Wunused-variable]
crypto_mod.c: In function 'w_crypto_aes_decrypt':
crypto_mod.c:241:17: error: storage size of 'de' isn't known
EVP_CIPHER_CTX de;
^~
crypto_mod.c:241:17: warning: unused variable 'de' [-Wunused-variable]
crypto_mod.c: In function 'crypto_aes_test':
crypto_mod.c:436:17: error: storage size of 'en' isn't known
EVP_CIPHER_CTX en, de;
^~
crypto_mod.c:436:21: error: storage size of 'de' isn't known
EVP_CIPHER_CTX en, de;
^~
crypto_mod.c:436:21: warning: unused variable 'de' [-Wunused-variable]
crypto_mod.c:436:17: warning: unused variable 'en' [-Wunused-variable]
EVP_CIPHER_CTX en, de;
^~
../../Makefile.rules:97: recipe for target 'crypto_mod.o' failed
make[1]: *** [crypto_mod.o] Error 1
Makefile:511: recipe for target 'modules' failed
make: *** [modules] Error 1
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/834