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

Răzvan Crainea noreply at github.com
Fri Nov 8 11:27:53 EST 2019


  Branch: refs/heads/master
  Home:   https://github.com/OpenSIPS/opensips
  Commit: 14e15150dde76087b7fd0e275a38512cefab7cb7
      https://github.com/OpenSIPS/opensips/commit/14e15150dde76087b7fd0e275a38512cefab7cb7
  Author: Razvan Crainea <razvan at opensips.org>
  Date:   2019-11-08 (Fri, 08 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.





More information about the Devel mailing list