Commit Graph

8 Commits

Author SHA1 Message Date
Harald Welte 6b369a4cfd Allow application to override default heap allocator
Let's introduce a mechanism by which libsmpp34-using applications can
override the memory allocator functions.  This allows us e.g. in the
Osmocom context to use talloc which aids us in debugging memory leaks.

Closes: OS#3913
Change-Id: I3656117115e89638c093bfbcbc4369ce302f7a94
2019-04-11 06:12:40 +00:00
Pau Espin c63971fab0 Fix Out of bounds compilation warning in OCTET8
The code in OCTET8 implementation assumes the len is placed inside the
byte preceding the memory buffer, which is true for the defined cases.
However, it creates a compilation warning. Better pass the value
directly from the struct field rather than playing addr games. this way
we also assert we require to explicitly pass the len.

Fixes lots of warning like the one below:
/home/pespin/dev/sysmocom/bin/../git/libsmpp34/src/smpp34_unpack.c: In function ‘smpp34_u
npack’:
/home/pespin/dev/sysmocom/bin/../git/libsmpp34/src/smpp34_unpack.c:147:14: warning: array
 subscript is above array bounds [-Warray-bounds]
     lenval = *((inst par) - 1);\
              ^~~~~~~~~~~~~~~~~
/home/pespin/dev/sysmocom/bin/../git/libsmpp34/def_frame/submit_sm.frame:18:2: note: in e
xpansion of macro ‘OCTET8’
  OCTET8( instancia, short_message, 254 );
  ^~~~~~

Change-Id: Id110f4e977c3becdb44cf5492c372e530ea51551
2017-09-15 20:24:25 +02:00
Pau Espin 43dc9992bc smpp34_unpack.c: remove unused variable
Fixes compilation warning below:
/home/pespin/dev/sysmocom/bin/../git/libsmpp34/src/smpp34_unpack.c: In function ‘smpp34_unpack’:
/home/pespin/dev/sysmocom/bin/../git/libsmpp34/src/smpp34_unpack.c:232:18: warning: variable ‘l’ set but not used [
-Wunused-but-set-variable]
         uint32_t l;

Change-Id: I75baa65b575deec1cc040490f2e76ebb54e46ca7
2017-09-15 20:24:22 +02:00
Ruben Undheim 8b61a0555a Fix various typos in log messages
Change-Id: If52a8546b09ac14c00e6323984eda6d88a558830
Reviewed-on: https://gerrit.osmocom.org/115
Reviewed-by: Neels Hofmeyr <nhofmeyr@sysmocom.de>
Tested-by: Jenkins Builder
2016-05-25 20:07:55 +00:00
Holger Hans Peter Freyther ef554d0880 const: Make the data parameter for unpack const 2013-09-05 22:43:40 +02:00
Holger Hans Peter Freyther eca1440439 misc: Always include stdint.h as it is almost 2013 now
C99 is there for over a decode, always depend on the stdint header
being present, specially as the code is using uint32_t all over the
place.
2012-11-09 13:39:51 +01:00
Holger Hans Peter Freyther ac4af14ab1 misc: Use stdlib.h instead of malloc.h to make it compile on FreeBSD
/usr/include/malloc.h:3:2: error: #error "<malloc.h> has been replaced by <stdlib.h>"
2012-11-09 11:49:49 +01:00
Harald Welte 4b233b4f3b initial import of libsmpp34-1.10 2012-11-07 08:32:31 +01:00