Module: kamailio
Branch: master
Commit: 5488a913c53d16449146625da278eec8779fdbc5
URL:
https://github.com/kamailio/kamailio/commit/5488a913c53d16449146625da278eec…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2016-11-06T22:40:42+01:00
corex: handle return code for ftell
---
Modified: modules/corex/corex_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/5488a913c53d16449146625da278eec…
Patch:
https://github.com/kamailio/kamailio/commit/5488a913c53d16449146625da278eec…
---
diff --git a/modules/corex/corex_mod.c b/modules/corex/corex_mod.c
index 3c87f21..8d9c6e7 100644
--- a/modules/corex/corex_mod.c
+++ b/modules/corex/corex_mod.c
@@ -341,6 +341,10 @@ static int w_file_read(sip_msg_t *msg, char *fn, char *vn)
}
fseek(f, 0, SEEK_END);
fsize = ftell(f);
+ if(fsize<0) {
+ LM_ERR("ftell failed on file: %.*s\n", fname.len, fname.s);
+ return -1;
+ }
fseek(f, 0, SEEK_SET);
content = pkg_malloc(fsize + 1);