[sr-dev] git:master:0c99fed4: snmpstats: fix allocator sizeof operand mismatch

Daniel-Constantin Mierla miconda at gmail.com
Tue May 3 19:10:16 CEST 2022


Module: kamailio
Branch: master
Commit: 0c99fed48403e2cc4f24441901b81b7c51411511
URL: https://github.com/kamailio/kamailio/commit/0c99fed48403e2cc4f24441901b81b7c51411511

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2022-05-03T19:07:41+02:00

snmpstats: fix allocator sizeof operand mismatch

---

Modified: src/modules/snmpstats/snmpSIPRegUserLookupTable.c
Modified: src/modules/snmpstats/snmpSIPRegUserTable.c

---

Diff:  https://github.com/kamailio/kamailio/commit/0c99fed48403e2cc4f24441901b81b7c51411511.diff
Patch: https://github.com/kamailio/kamailio/commit/0c99fed48403e2cc4f24441901b81b7c51411511.patch

---

diff --git a/src/modules/snmpstats/snmpSIPRegUserLookupTable.c b/src/modules/snmpstats/snmpSIPRegUserLookupTable.c
index 9ded597b83..f00dde9ac7 100644
--- a/src/modules/snmpstats/snmpSIPRegUserLookupTable.c
+++ b/src/modules/snmpstats/snmpSIPRegUserLookupTable.c
@@ -520,7 +520,7 @@ void kamailioSIPRegUserLookupTable_set_action(netsnmp_request_group *rg)
 			case COLUMN_KAMAILIOSIPREGUSERLOOKUPURI:
 
 				row_ctx->kamailioSIPRegUserLookupURI =
-						pkg_malloc(sizeof(char) * (var->val_len + 1));
+						pkg_malloc(sizeof(unsigned char) * (var->val_len + 1));
 
 				memcpy(row_ctx->kamailioSIPRegUserLookupURI, var->val.string,
 						var->val_len);
@@ -776,4 +776,4 @@ kamailioSIPRegUserLookupTable_get_by_idx(netsnmp_index *hdr)
 {
 	return (const kamailioSIPRegUserLookupTable_context *)CONTAINER_FIND(
 			cb.container, hdr);
-}
\ No newline at end of file
+}
diff --git a/src/modules/snmpstats/snmpSIPRegUserTable.c b/src/modules/snmpstats/snmpSIPRegUserTable.c
index 4ad5bf3307..6d4270a188 100644
--- a/src/modules/snmpstats/snmpSIPRegUserTable.c
+++ b/src/modules/snmpstats/snmpSIPRegUserTable.c
@@ -248,7 +248,7 @@ int createRegUserRow(char *stringToRegister)
 	theRow->kamailioSIPUserIndex = index;
 
 	theRow->kamailioSIPUserUri =
-			(unsigned char *)pkg_malloc(stringLength * sizeof(char));
+			(unsigned char *)pkg_malloc(stringLength * sizeof(unsigned char));
 	if(theRow->kamailioSIPUserUri == NULL) {
 		pkg_free(OIDIndex);
 		free(theRow);
@@ -378,4 +378,4 @@ const kamailioSIPRegUserTable_context *kamailioSIPRegUserTable_get_by_idx(
 {
 	return (const kamailioSIPRegUserTable_context *)CONTAINER_FIND(
 			cb.container, hdr);
-}
\ No newline at end of file
+}




More information about the sr-dev mailing list