[OpenSIPS-Devel] [OpenSIPS/opensips] a08612: proto_smpp: make sure fields do not overlap

Răzvan Crainea noreply at github.com
Mon Nov 11 03:10:34 EST 2019


  Branch: refs/heads/3.0
  Home:   https://github.com/OpenSIPS/opensips
  Commit: a086123ff4457fd8feba08af6022abaf6e3123da
      https://github.com/OpenSIPS/opensips/commit/a086123ff4457fd8feba08af6022abaf6e3123da
  Author: Razvan Crainea <razvan at opensips.org>
  Date:   2019-11-11 (Mon, 11 Nov 2019)

  Changed paths:
    M modules/proto_smpp/smpp.c
    M modules/proto_smpp/smpp.h
    M modules/proto_smpp/utils.c
    M modules/proto_smpp/utils.h

  Log Message:
  -----------
  proto_smpp: make sure fields do not overlap

SMPP C-Octet String is defined as a limited number of characters,
followed by a NULL terminator. This means that a SMPP field consisting
of maximum N characters, can only have N-1 useful data + 1 NULL
terminator.

However, in real life, some operators require 9 length passwords, which
result in 10 chars password fields, which conflicts with the SMPP
specification. Check this thread for more information (yeah, I know
it's old, but it is still relevant):
https://devel.kannel.narkive.com/iyzAKxzC/smpp-maximum-password-length

This commit "breaks" a bit the SMPP 3.4 specs, allowing data to have N
characters _without_ the NULL termination, resulting in N+1 fields tops
(i.e. the password field can have 9 chars + '\0' = 10 chars). Although
this is not 100% correct, this makes our module more flexible, because
if you don't need 9-long passwords, it will be just fine. So the specs
are broken *only* if the provider requires it.

This commit also fixes a bug (described in ticket #1867), where OpenSIPS
was not storing a NULL termination for certain strings in their internal
storage, resulted in strings concatenated together in resulted messages.

(cherry picked from commit 14e15150dde76087b7fd0e275a38512cefab7cb7)





More information about the Devel mailing list