Commit Graph

15 Commits

Author SHA1 Message Date
Karsten Keil 710b87dcb9 Fix possible buffer overflows detected by newer GCC versions
GCC reports problems like this:

gcc -DHAVE_CONFIG_H -I. -I../include -I../include -Wall -Werror -I./include -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -MT layer3/q931.lo -MD -MP -MF layer3/.deps/q931.Tpo -c layer3/q931.c  -fPIC -DPIC -o layer3/.libs/q931.o
In file included from /usr/include/string.h:494,
                 from layer3/q931.c:22:
In function ‘strncpy’,
    inlined from ‘mi_encode_redirecting_nr’ at layer3/q931.c:531:3:
/usr/include/bits/string_fortified.h:106:10: error: ‘__builtin_strncpy’ forming offset [25, 31] is out of the bounds [0, 24] of object ‘ie’ with type ‘unsigned char[24]’ [-Werror=array-bounds]
   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Thanks to Tobias Powalowski for reporting this
This commit fixes issue #9 on github.
2018-07-18 07:27:41 +02:00
Karsten Keil c9e711960b Some more const declarations since some crosscompilers are more picky here 2017-07-30 22:29:26 +02:00
Karsten Keil 234e9bc9ce Fix none existing octets 5b1/5b2 in bearer capabilities
Here exist two differnt content versions of octet 5b in bearer capabilities
but only alternatively depending on the L1 protocol, so we only need one octet 5b here.
2017-07-30 22:29:24 +02:00
Karsten Keil ec4ac2763f Fix compile error with newer gcc (and a reaL BUG)
layer3/q931.c: In function 'mi_encode_hlc':
layer3/q931.c:360:3: error: statement with no effect [-Werror=unused-value]
   ie[1] | 0x80;
   ^
Thanks to Tobias Powalowski pointing to this issue
.
2013-05-20 15:16:19 +02:00
Norbert Weyrich df131f57d4 decode and encode functions for notification indicator information element 2012-11-14 14:19:01 +01:00
Norbert Weyrich 30721084cb fix pres handling in mi_encode_connected_nr() improved 2012-08-30 12:29:46 +02:00
Norbert Weyrich 7126cf843a fix mi_encode_channel_id(): channel number was not set 2012-08-20 11:42:42 +02:00
Karsten Keil 5a8bc05f3b Fix encoding channel ID for PRI
Found-by: Norbert Weyrich <norbert.weyrich@tennet-hh.de>
Signed-off-by: Karsten Keil <kkeil@linux-pingi.de>
2012-08-20 09:50:34 +02:00
Karsten Keil f5aa175db8 Fix compiler warnings (taken as errors now)
Found-by: Norbert Weyrich <norbert.weyrich@tennet-hh.de>
Signed-off-by: Karsten Keil <kkeil@linux-pingi.de>
2012-08-20 09:31:38 +02:00
Karsten Keil 7aeadbfe54 Fix more compiler warnings
Signed-off-by: Karsten Keil <kkeil@linux-pingi.de>
2012-08-17 12:58:30 +02:00
Karsten Keil 91c5d28565 Remove extension bit from the channel number
On PRI the extension bit is not part of the channel number.

Signed-off-by: Karsten Keil <kkeil@linux-pingi.de>
2012-07-31 09:01:38 +02:00
Thomas Jarosch dfa4b851ef No need to check unsigned variable for less than zero
cppcheck reported:
[lib/layer3/q931.c:429]: (style) Checking if unsigned variable 'screen' is less than zero.
[lib/layer3/q931.c:455]: (style) Checking if unsigned variable 'screen' is less than zero.

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
Signed-off-by: Karsten Keil <kkeil@linux-pingi.de>
2012-05-02 16:12:49 +02:00
Karsten Keil dfe6d7e8e9 Add HLC decode/encode
Add functions to decode/encod HLC IE.

Signed-off-by: Karsten Keil <kkeil@linux-pingi.de>
2011-10-20 18:42:03 +02:00
Karsten Keil 644e28fa6b Make supplementary services finally work
Fix lot of bugs and implement a interface for applications

Signed-off-by: Karsten Keil <kkeil@linux-pingi.de>
2011-09-21 15:30:51 +02:00
Karsten Keil cc22700354 Restructure directories
It seems better to have seperated directories for different
parts of the library and also put the suplementary service
stuff into the same library.

Signed-off-by: Karsten Keil <kkeil@linux-pingi.de>
2011-09-21 15:30:40 +02:00