Re: [PATCH] octstr.c, octrst_imm, one more check

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

-1 for this patch...

please see gwlib/octstr.c:
static Octstr *immutables[MAX_IMMUTABLES];

it's never NULL...

Wilfried Goesgens wrote:

> I've struggled over some condition making octstr_imm stumble,
> this check keeps it from segfaulting.
> 
> sincerely,
> Wilfried Goesgens
> 
> 
> 
> gwlib/octstr.c        2005-04-13 18:13:38.000000000 +0200
> +++ octstr.c    2005-04-13 18:49:03.000000000 +0200
> @@ -285,7 +285,7 @@ Octstr *octstr_imm(const char *cstr)
>      mutex_lock(&immutables_mutex);
>      i = index;
>      for (; ; ) {
> -       if (immutables[i] == NULL || immutables[i]->data == data)
> +       if (immutables == NULL || immutables[i] == NULL ||
> immutables[i]->data == data)
>              break;
>          i = (i + 1) % MAX_IMMUTABLES;
>          if (i == index)

-- 
Thanks,
Alex
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.