Module: kamailio
Branch: 4.4
Commit: eb67c0ada2934f2d212645e8a7315eec6e368c4f
URL:
https://github.com/kamailio/kamailio/commit/eb67c0ada2934f2d212645e8a7315ee…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-03-21T02:52:58+01:00
textops: safety check of allocated memory inside append_time_request_f()
- reported by GH #1040
(cherry picked from commit a51a32633429d761f8bc742386b6f6bcb6b38522)
(cherry picked from commit 0ff6b710d0a5729778b3de1a15666e29d73aec56)
---
Modified: modules/textops/textops.c
---
Diff:
https://github.com/kamailio/kamailio/commit/eb67c0ada2934f2d212645e8a7315ee…
Patch:
https://github.com/kamailio/kamailio/commit/eb67c0ada2934f2d212645e8a7315ee…
---
diff --git a/modules/textops/textops.c b/modules/textops/textops.c
index b209e36..2fc341c 100644
--- a/modules/textops/textops.c
+++ b/modules/textops/textops.c
@@ -1214,6 +1214,10 @@ static int append_time_request_f(struct sip_msg* msg, char* p1,
char *p2)
}
time_str.s = pkg_malloc(MAX_TIME);
+ if(time_str.s==NULL) {
+ LM_ERR("no more pkg memory\n");
+ goto error;
+ }
time_str.len=strftime(time_str.s, MAX_TIME, TIME_FORMAT, bd_time);
if (time_str.len>MAX_TIME-2 || time_str.len==0) {
LM_ERR("unexpected time length\n");