浏览代码

snmpstats: fix allocator sizeof operand mismatch

Daniel-Constantin Mierla 3 年之前
父节点
当前提交
0c99fed484
共有 2 个文件被更改,包括 4 次插入4 次删除
  1. 2 2
      src/modules/snmpstats/snmpSIPRegUserLookupTable.c
  2. 2 2
      src/modules/snmpstats/snmpSIPRegUserTable.c

+ 2 - 2
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);
-}
+}

+ 2 - 2
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);
-}
+}