-
Notifications
You must be signed in to change notification settings - Fork 7
Description
compiling misdnuser with gcc 11.2.0 two functions throw array subscript bound errors. Perhaps false positives, perhaps not:
-
>>>
In file included from misc/mbuffer.c:21:
misc/mbuffer.c: In function ‘alloc_mbuffer’:
../include/mISDN/mbuffer.h:161:14: error: array subscript ‘struct mbuffer[0]’ is partly outside array bounds of ‘struct mqueue[1]’ [-Werror=array-bounds]
161 | next = prev->next;
| ~~~~~~~^~~~~~~~~~~~
misc/mbuffer.c:25:25: note: while referencing ‘free_queue_l2’
25 | static struct mqueue free_queue_l2, free_queue_l3;
<<<
by changing in this function like this:
prev = (struct mbuffer *)q->prev;
next = (struct mbuffer *)q->next;
the error disappears but not sure whether functionality is still correct. All the prev and next in both queue and buffer is rather confusing without an idea how this is supposed to function. -
>>>
bridge.c: In function ‘ph_control’:
bridge.c:160:9: error: array subscript 2 is outside array bounds of ‘unsigned char[16]’ [-Werror=array-bounds]
160 | *d++ = c2;
| ^~~~
bridge.c:150:23: note: while referencing ‘data’
150 | unsigned char data[MISDN_HEADER_LEN+sizeof(int)+sizeof(int)];
<<<
by adding 8, like:
unsigned char data[MISDN_HEADER_LEN+sizeof(int)+sizeof(int)+8];
the error disappears but again not sure whether this is changing the intended behaviour.