[sr-dev] git:master:7db39bbc: pdbt: add pdb server message check

Stefan Mititelu stefan.mititelu at enea.com
Fri Feb 28 12:40:55 CET 2020


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

Author: Stefan Mititelu <stefan.mititelu92 at gmail.com>
Committer: Stefan Mititelu <stefan.mititelu at enea.com>
Date: 2020-02-28T13:40:47+02:00

pdbt: add pdb server message check

Related to 3c07e2351a94e4ff2cf3c6b9b9df4d7462cd5760 commit, but on server side.

---

Modified: utils/pdbt/common.c

---

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

---

diff --git a/utils/pdbt/common.c b/utils/pdbt/common.c
index cd7b6558c4..f5bc54ecc8 100644
--- a/utils/pdbt/common.c
+++ b/utils/pdbt/common.c
@@ -11,9 +11,15 @@ void pdb_msg_dbg(struct pdb_msg msg) {
     LERR("id = %d\n", msg.hdr.id);
     LERR("len = %d\n", msg.hdr.length);
     LERR("payload = ");
-    for (i = 0; i < msg.hdr.length - sizeof(msg.hdr); i++) {
-        LERR("%02X ", msg.bdy.payload[i]);
+
+    if(msg.hdr.length > sizeof(msg.hdr)) {
+        for (i = 0; i < msg.hdr.length - sizeof(msg.hdr); i++) {
+            LERR("%02X ", msg.bdy.payload[i]);
+        }
+    } else {
+        LERR("Incorrect value in msg.hdr.length \n");
     }
+
     LERR("\n");
 
     return ;




More information about the sr-dev mailing list