Re: PANIC: gwlib/octstr.c ...

Alexander Malysh <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Organization Centrium GmbH
Message-ID <[email protected]>
Hi Igor,

++1 for this patch... 
It's 100% wrong to use octstr_imm for non const c-strings. And this can also 
explain why we have seen panics with "too many immutable octstr"...

On Friday 07 November 2003 18:55, Igor Ivoilov wrote:
> The problem with
> PANIC: gwlib/octstr.c:2159: seems_valid_real: Assertion
> `ostr->data[ostr->len] == '\0'' failed. (Called from
> gwlib/octstr.c:923:octstr_case_search.)
>
> I have fixed to myself with the patch below.
> It means that something is terribly wrong in immutable octstr.
> I will run the patched wapgateway on weekend and see for other problems and
> than commit it to cvs. Any comments are appreciated
>
> Igor
>
> Index: gwlib/http.c
> ===================================================================
> RCS file: /home/cvs/gateway/gwlib/http.c,v
> retrieving revision 1.208
> diff -b -u -r1.208 http.c
> --- gwlib/http.c	24 Oct 2003 20:24:55 -0000	1.208
> +++ gwlib/http.c	7 Nov 2003 17:38:41 -0000
> @@ -3000,6 +3000,7 @@
>      int found;
>      long i;
>      List *accepts;
> +    Octstr *needle = octstr_create(what);
>
>      gwlib_assert_init();
>      gw_assert(headers != NULL);
> @@ -3011,10 +3012,10 @@
>      found = 0;
>      for (i = 0; !found && i < list_len(accepts); ++i) {
>          Octstr *header_value = list_get(accepts, i);
> -        if (octstr_case_search(header_value, octstr_imm(what), 0) != -1)
> +        if (octstr_case_search(header_value, needle, 0) != -1)
>              found = 1;
>      }
> -
> +	octstr_destroy(needle);
>      http_destroy_headers(accepts);
>      return found;
>  }

-- 
Best regards / Mit besten Grüßen aus Düsseldorf

Dipl.-Ing.
Alexander Malysh
___________________________________________

Centrium GmbH
Vogelsanger Weg 80
40470 Düsseldorf

Fon: +49 (0211) 74 84 51 80
Fax: +49 (0211) 277 49 109

email: [email protected]
web: www.centrium.de
msn: [email protected]
icq: 98063111
___________________________________________

Please avoid sending me Word, Excel or PowerPoint attachments.
See http://www.fsf.org/philosophy/no-word-attachments.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.