Actions

## Bug #5292

open### cppcheck: "portability" warnings: using void pointers in calculations

Affected Versions:

Effort:

Difficulty:

Label:

**Description**

src/app-layer-ssl.c:225:20: portability: 'dst' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. Arithmetic operations on 'void *' is a GNU C extension, which defines the 'sizeof(void)' to be 1. [arithOperationsOnVoidPointer] memcpy(dst + dst_offset, src + src_offset, src_tocopy); ^ src/app-layer-ssl.c:225:38: portability: 'src' is of type 'const void *'. When using void pointers in calculations, the behaviour is undefined. Arithmetic operations on 'void *' is a GNU C extension, which defines the 'sizeof(void)' to be 1. [arithOperationsOnVoidPointer] memcpy(dst + dst_offset, src + src_offset, src_tocopy); ^ src/device-storage.c:77:49: portability: '(void*)d' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. Arithmetic operations on 'void *' is a GNU C extension, which defines the 'sizeof(void)' to be 1. [arithOperationsOnVoidPointer] return StorageSetById((Storage *)((void *)d + sizeof(LiveDevice)), STORAGE_DEVICE, id.id, ptr); ^ src/device-storage.c:90:49: portability: '(void*)d' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. Arithmetic operations on 'void *' is a GNU C extension, which defines the 'sizeof(void)' to be 1. [arithOperationsOnVoidPointer] return StorageGetById((Storage *)((void *)d + sizeof(LiveDevice)), STORAGE_DEVICE, id.id); ^ src/device-storage.c:102:35: portability: '(void*)d' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. Arithmetic operations on 'void *' is a GNU C extension, which defines the 'sizeof(void)' to be 1. [arithOperationsOnVoidPointer] (Storage *)((void *)d + sizeof(LiveDevice)), STORAGE_DEVICE, id.id); ^ src/device-storage.c:107:43: portability: '(void*)d' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. Arithmetic operations on 'void *' is a GNU C extension, which defines the 'sizeof(void)' to be 1. [arithOperationsOnVoidPointer] StorageFreeById((Storage *)((void *)d + sizeof(LiveDevice)), STORAGE_DEVICE, id.id); ^ src/device-storage.c:113:46: portability: '(void*)d' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. Arithmetic operations on 'void *' is a GNU C extension, which defines the 'sizeof(void)' to be 1. [arithOperationsOnVoidPointer] StorageFreeAll((Storage *)((void *)d + sizeof(LiveDevice)), STORAGE_DEVICE); ^ src/flow-storage.c:41:49: portability: '(void*)f' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. Arithmetic operations on 'void *' is a GNU C extension, which defines the 'sizeof(void)' to be 1. [arithOperationsOnVoidPointer] return StorageGetById((Storage *)((void *)f + sizeof(Flow)), STORAGE_FLOW, id.id); ^ src/flow-storage.c:46:49: portability: '(void*)f' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. Arithmetic operations on 'void *' is a GNU C extension, which defines the 'sizeof(void)' to be 1. [arithOperationsOnVoidPointer] return StorageSetById((Storage *)((void *)f + sizeof(Flow)), STORAGE_FLOW, id.id, ptr); ^ src/flow-storage.c:51:59: portability: '(void*)f' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. Arithmetic operations on 'void *' is a GNU C extension, which defines the 'sizeof(void)' to be 1. [arithOperationsOnVoidPointer] return StorageAllocByIdPrealloc((Storage *)((void *)f + sizeof(Flow)), STORAGE_FLOW, id.id); ^ src/flow-storage.c:56:43: portability: '(void*)f' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. Arithmetic operations on 'void *' is a GNU C extension, which defines the 'sizeof(void)' to be 1. [arithOperationsOnVoidPointer] StorageFreeById((Storage *)((void *)f + sizeof(Flow)), STORAGE_FLOW, id.id); ^ src/flow-storage.c:62:46: portability: '(void*)f' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. Arithmetic operations on 'void *' is a GNU C extension, which defines the 'sizeof(void)' to be 1. [arithOperationsOnVoidPointer] StorageFreeAll((Storage *)((void *)f + sizeof(Flow)), STORAGE_FLOW); ^ src/host-storage.c:77:49: portability: '(void*)h' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. Arithmetic operations on 'void *' is a GNU C extension, which defines the 'sizeof(void)' to be 1. [arithOperationsOnVoidPointer] return StorageSetById((Storage *)((void *)h + sizeof(Host)), STORAGE_HOST, id.id, ptr); ^ src/host-storage.c:90:49: portability: '(void*)h' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. Arithmetic operations on 'void *' is a GNU C extension, which defines the 'sizeof(void)' to be 1. [arithOperationsOnVoidPointer] return StorageGetById((Storage *)((void *)h + sizeof(Host)), STORAGE_HOST, id.id); ^ src/host-storage.c:101:59: portability: '(void*)h' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. Arithmetic operations on 'void *' is a GNU C extension, which defines the 'sizeof(void)' to be 1. [arithOperationsOnVoidPointer] return StorageAllocByIdPrealloc((Storage *)((void *)h + sizeof(Host)), STORAGE_HOST, id.id); ^ src/host-storage.c:106:43: portability: '(void*)h' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. Arithmetic operations on 'void *' is a GNU C extension, which defines the 'sizeof(void)' to be 1. [arithOperationsOnVoidPointer] StorageFreeById((Storage *)((void *)h + sizeof(Host)), STORAGE_HOST, id.id); ^ src/host-storage.c:112:46: portability: '(void*)h' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. Arithmetic operations on 'void *' is a GNU C extension, which defines the 'sizeof(void)' to be 1. [arithOperationsOnVoidPointer] StorageFreeAll((Storage *)((void *)h + sizeof(Host)), STORAGE_HOST); ^ src/ippair-storage.c:37:49: portability: '(void*)h' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. Arithmetic operations on 'void *' is a GNU C extension, which defines the 'sizeof(void)' to be 1. [arithOperationsOnVoidPointer] return StorageGetById((Storage *)((void *)h + sizeof(IPPair)), STORAGE_IPPAIR, id.id); ^ src/ippair-storage.c:42:49: portability: '(void*)h' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. Arithmetic operations on 'void *' is a GNU C extension, which defines the 'sizeof(void)' to be 1. [arithOperationsOnVoidPointer] return StorageSetById((Storage *)((void *)h + sizeof(IPPair)), STORAGE_IPPAIR, id.id, ptr); ^ src/ippair-storage.c:47:59: portability: '(void*)h' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. Arithmetic operations on 'void *' is a GNU C extension, which defines the 'sizeof(void)' to be 1. [arithOperationsOnVoidPointer] return StorageAllocByIdPrealloc((Storage *)((void *)h + sizeof(IPPair)), STORAGE_IPPAIR, id.id); ^ src/ippair-storage.c:52:43: portability: '(void*)h' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. Arithmetic operations on 'void *' is a GNU C extension, which defines the 'sizeof(void)' to be 1. [arithOperationsOnVoidPointer] StorageFreeById((Storage *)((void *)h + sizeof(IPPair)), STORAGE_IPPAIR, id.id); ^ src/ippair-storage.c:58:46: portability: '(void*)h' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. Arithmetic operations on 'void *' is a GNU C extension, which defines the 'sizeof(void)' to be 1. [arithOperationsOnVoidPointer] StorageFreeAll((Storage *)((void *)h + sizeof(IPPair)), STORAGE_IPPAIR); ^ src/source-af-packet.c:1774:22: portability: 'base' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. Arithmetic operations on 'void *' is a GNU C extension, which defines the 'sizeof(void)' to be 1. [arithOperationsOnVoidPointer] base += ptv->req.v2.tp_frame_size; ^ src/util-mpm-ac-ks.c:931:39: portability: 'mem_block' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. Arithmetic operations on 'void *' is a GNU C extension, which defines the 'sizeof(void)' to be 1. [arithOperationsOnVoidPointer] uint8_t *string_space = mem_block + pattern_list_size; ^ src/util-rohash.c:122:44: portability: '(void*)table' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. Arithmetic operations on 'void *' is a GNU C extension, which defines the 'sizeof(void)' to be 1. [arithOperationsOnVoidPointer] ROHashTableOffsets *os = (void *)table + sizeof(ROHashTable); ^ src/util-rohash.c:134:13: portability: 'table->data' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. Arithmetic operations on 'void *' is a GNU C extension, which defines the 'sizeof(void)' to be 1. [arithOperationsOnVoidPointer] if (SCMemcmp(table->data + offset, data, table->item_size) == 0) { ^ src/util-rohash.c:135:13: portability: 'table->data' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. Arithmetic operations on 'void *' is a GNU C extension, which defines the 'sizeof(void)' to be 1. [arithOperationsOnVoidPointer] SCReturnPtr(table->data + offset, "void"); ^ src/util-rohash.c:166:29: portability: '(void*)item' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. Arithmetic operations on 'void *' is a GNU C extension, which defines the 'sizeof(void)' to be 1. [arithOperationsOnVoidPointer] memcpy((void *)item + sizeof(ROHashTableItem), value, table->item_size); ^ src/util-rohash.c:191:44: portability: '(void*)table' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. Arithmetic operations on 'void *' is a GNU C extension, which defines the 'sizeof(void)' to be 1. [arithOperationsOnVoidPointer] ROHashTableOffsets *os = (void *)table + sizeof(ROHashTable); ^ src/util-rohash.c:195:47: portability: '(void*)item' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. Arithmetic operations on 'void *' is a GNU C extension, which defines the 'sizeof(void)' to be 1. [arithOperationsOnVoidPointer] uint32_t hash = hashword((void *)item + sizeof(*item), table->item_size/4, 0) & hashmask(table->hash_bits); ^ src/util-rohash.c:232:47: portability: '(void*)item' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. Arithmetic operations on 'void *' is a GNU C extension, which defines the 'sizeof(void)' to be 1. [arithOperationsOnVoidPointer] uint32_t hash = hashword((void *)item + sizeof(*item), table->item_size/4, 0) & hashmask(table->hash_bits); ^ src/util-rohash.c:237:28: portability: 'table->data' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. Arithmetic operations on 'void *' is a GNU C extension, which defines the 'sizeof(void)' to be 1. [arithOperationsOnVoidPointer] memcpy(table->data + offset, (void *)item + sizeof(*item), table->item_size); ^ src/util-rohash.c:237:51: portability: '(void*)item' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. Arithmetic operations on 'void *' is a GNU C extension, which defines the 'sizeof(void)' to be 1. [arithOperationsOnVoidPointer] memcpy(table->data + offset, (void *)item + sizeof(*item), table->item_size); ^

No data to display

Actions