[PD] zexy list2symbol ... corrected
IOhannes m zmoelnig
zmoelnig at iem.kug.ac.at
Wed Sep 5 20:58:49 CEST 2001
hi all!
i am home again at last.
funny thing about the list2symbol, because the bug was not reproducible
for me under linux (but it crashed under NT).
anyhow, i have put on a new version of zexy (being 1.1) on our
ftp-server ftp://iem.kug.ac.at/pd/Externals/ZEXY
the main udpate is indeed the bug-fixed Juha has done. thanks
mfg.dsa.sdt
IOhannes
Juha Vehviläinen wrote:
>
> Ok, I was able to trace and correct a memory bug in zexy's
> list2symbol, and the corrected list2symbol_bang looks like this:
>
> (in z_strings.c)
>
> ----- clip -----
> static void list2symbol_bang(t_list2symbol *x)
> {
> char *str=0, *s2;
> int n=0;
>
> binbuf_gettext(x->bbuf, &str, &n);
>
> // str[n]=0; // memory bug!
> s2 = malloc(n+1);
> strncpy(s2, str, n);
> s2[n]=0;
>
> outlet_symbol(x->x_obj.ob_outlet, gensym(s2/*str*/));
> freebytes(str, n);
> free(s2);
> }
> ----- clip -----
>
> I'm no c expert, so I'm sure you'll make a similar, proper fix
> in the next zexy-patch...
>
> It seems that binbuf_gettext() only allocs n bytes of memory for str,
> and doesn't put a \0 at the end, why so?
>
> As I said, list2symbol is essential...
>
More information about the Pd-list
mailing list