[PATCH]: octstr_format crash
"Rene Kluwen" <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
For your convenience, I also attached the patch to this email. This is a fairly trivial and reasonably severe bug (crash). Comments / Votes? Rene Kluwen Chimit -----Original Message----- From: Apache [mailto:[email protected]]On Behalf Of [email protected] Sent: maandag 13 maart 2006 20:14 Subject: [Kannel 0000323]: octstr_format crash The following NEW bug has been ADDED. ======================================================================= http://bugs.kannel.org/view_bug_page.php?f_id=0000323 ======================================================================= Reporter: rene Handler: rene ======================================================================= Project: Kannel Bug ID: 0000323 Category: General Reproducibility: random Severity: major Priority: high Status: assigned ======================================================================= Date Submitted: 03-13-06 19:14 GMT Last Modified: 03-13-06 19:14 GMT ======================================================================= Summary: octstr_format crash Description: If some parameter of the octstr_format() function (besides the format itself) is NULL and supposed to be displayed as -for example- %S, then octstr_format crashes. Patch to fix is attached to this bug report. I never bothered about octstr.c.debug. This is left as an exercise to the reader. =======================================================================
octstr.c.patch
(application/octet-stream, 1.3 KB)
Index: gwlib/octstr.c
===================================================================
RCS file: /home/cvs/gateway/gwlib/octstr.c,v
retrieving revision 1.171
diff -u -r1.171 octstr.c
--- gwlib/octstr.c 23 Feb 2006 01:25:17 -0000 1.171
+++ gwlib/octstr.c 13 Mar 2006 19:08:41 -0000
@@ -2308,7 +2308,7 @@
case 'S':
new = octstr_duplicate(va_arg(VALST(args), Octstr *));
if (!new)
- new = octstr_imm("(null)");
+ new = octstr_create("(null)");
if (format->has_prec)
octstr_truncate(new, format->prec);
break;
@@ -2316,7 +2316,7 @@
case 'E':
new = octstr_duplicate(va_arg(VALST(args), Octstr *));
if (!new)
- new = octstr_imm("(null)");
+ new = octstr_create("(null)");
octstr_url_encode(new);
/*
* note: we use blind truncate - encoded character can get cut half-way.
@@ -2328,7 +2328,7 @@
case 'H':
new = octstr_duplicate(va_arg(VALST(args), Octstr *));
if (!new)
- new = octstr_imm("(null)");
+ new = octstr_create("(null)");
/* upper case */
octstr_binary_to_hex(new, 1);
if (format->has_prec)
@@ -2336,7 +2336,7 @@
break;
case '%':
- new = octstr_imm("%");
+ new = octstr_create("%");
break;
default: