Re: WARNING: SMPP: PDU element <password> to long (length is 9, should be 9)
Stipe Tolj <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Organization | The Kannel Group |
| Message-ID | <[email protected]> |
Alexander Malysh wrote:
>
> NULTERMINATED as Aarno pointed already, is C string with terminating \0.
> max-octets is _including_ terminating \0. comparison > is no enough,
> because if octstr len even equal to max-octets than that means we will drop
> 1 octet (because \0 will be added at the end), so the warninng and
> comparison is correct. But in order to not confuse users we could do
> something like this:
> ...
> #define NULTERMINATED(name, max_octets) \
> if (p->name != NULL) { \
> if (octstr_len(p->name) >= max_octets) { \
> warning(0, "SMPP: PDU element <%s> to long " \
> "(length is %ld, should be %d)", \
> #name, octstr_len(p->name), max_octets - 1); \
> ^^^^^^^^^^^^^^
> temp = octstr_copy(p->name, 0, max_octets-1); \
> } else \
> temp = octstr_duplicate(p->name); \
> octstr_append(os, temp); \
> octstr_destroy(temp); \
> } \
> octstr_append_char(os, '\0');
> ...
agreed, +1, commited to cvs.
Stipe
mailto:stolj_{at}_wapme.de
-------------------------------------------------------------------
Wapme Systems AG
Vogelsanger Weg 80
40470 DÃŒsseldorf, NRW, Germany
phone: +49.211.74845.0
fax: +49.211.74845.299
mailto:info_{at}_wapme-systems.de
http://www.wapme-systems.de/
-------------------------------------------------------------------
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.2.2 (Cygwin)
mIsEP6mcYwEEAMDnUiUwrbb+xwTFWN6TxF2+XZu7/alwJMeCwMBRvXtPZqfjpPhS
OkBpU0F4TrVuugz1HINTSaJTYq10AzDQXp5NkyWgckqW79nPAWuOX0dicbJk+cN2
nM2TI4KaxUDe6u8hghNEnH/i2lXsUu9apnP/iixzV81VC2je3uc9hZpnAAYptEVT
dGlwZSBUb2xqIChUZWNobm9sb2d5IENlbnRlciAmIFJlc2VhcmNoIExhYikgPHRv
bGpAd2FwbWUtc3lzdGVtcy5kZT6ItAQTAQIAHgUCP6mcYwIbAwYLCQgHAwIDFQID
AxYCAQIeAQIXgAAKCRABV0w1BqPYRuSqA/wPzsQxao2YePENCtgRTrO86U6zg3sl
OcS6CJFI4FZP5h/xD3GRsNH1+MPSvZlomDdpFnr547DGz/Kq9MXuQwVvlVig5yWZ
K5dtKp1r5YLhxJQBhfirZbRFFnYmf19f18J8OoS28tuFVftDl1AIwJS3HLyBTv6H
g2HyLAEKQIp30Q==
=aYCI
-----END PGP PUBLIC KEY BLOCK-----