----- Original Message ----- From: "Stipe Tolj" <[EMAIL PROTECTED]> To: "Bruno David Rodrigues" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Monday, March 04, 2002 12:49 PM Subject: Re: [BUG] Smsbox crash with empty messages
> Bruno David Rodrigues wrote: > > > > smsbox panics on smsbox line 1180 because of a empty text field (NULL): > > > > http://www.kannel.3glab.org/cgi-bin/viewcvs.cgi/gateway/gw/smsbox.c? > > annotate=1.174#1180 > > > > In patch 1.164 at 2002/01/25: > > udh == NULL ? ( text == NULL ? "" : octstr_get_cstr(text) ) : "<< UDH >>"); > > > > udh == NULL ? ( text == NULL ? "" : octstr_get_cstr(text) ) : > > octstr_get_cstr(text)); > > > > Why ?! > > I'm reverting this line > > octstr_get_cstr() requires an non-NULL octstr pointer. > > So if text == NULL then octstr_get_cstr() throws the assertion error > and panics the smsbox. > > BTW, in the second statement you are not garanteeing that call to > octstr_get_cstr() does not have text == NULL, it's only handled in the > case udh == NULL. :P I asked why did syvanen changed the code like that ! I know what octstr_get_cstr does ;), that's why I've looked everywhere for lines using it and tried to be careful and inserted the (text == NULL ? "" : octstr_get_cstr(text)) back when I added the possibility of empty messages to smsbox. And it this particular line, we've talked about that, in general, when you have a udh, the text probably is binary (there weren't EMS back then), so it was not necessary to print the text when exists a udh. I guess syvanen thought in printing the text even if there is a udh. The correct way should be looking at coding variable and printing the text if coding=DC_7bits and hexencode it if coding=DC_8bits (and UCS?) but I don't usually look at smsbox logs... > > Stipe > > [EMAIL PROTECTED] > ------------------------------------------------------------------- > Wapme Systems AG > > Münsterstr. 248 > 40470 Düsseldorf > > Tel: +49-211-74845-0 > Fax: +49-211-74845-299 > > E-Mail: [EMAIL PROTECTED] > Internet: http://www.wapme-systems.de > ------------------------------------------------------------------- > wapme.net - wherever you are > > > >