[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [E-devel] ecore_path_group_available patch

On Sun, 10 Dec 2006 17:39:58 +0100 aji <ajiproduction@gmail.com> babbled:

> Hello,
> I found L244 in e17/libs/ecore/src/lib/ecore/ecore_path.c
> (ecore_path_group_available) a strdup with a non null-terminated string.
> The cause is L239:  "strncpy(n, d->d_name, l - 2);"  (so
> ecore_list_append(avail, strdup(n)); is wrong).
> I propose a little patch (it sets '\0' and respects PATH_MAX).
> Perhaps that the cvs version preserves the extension's dot (exemple "been.so"
> -> "been." ), but I don't understand why so I didn't preserve this one in my
> patch.

actually that code is just wrong. if it is listing available files (except dot
files and .so libs) why on earth is it nuking 2 chars off the end of the end of
filenames? this will be bad for filenames 2 chars or less in size (i smell a
segv here), you are right - it doesnt nul-terminate the names, andmore. not
sure why 'n' is even needed. fixed in cvs.

------------- Codito, ergo sum - "I code, therefore I am" --------------
The Rasterman (Carsten Haitzler)    raster@rasterman.com
Tokyo, Japan (東京 日本)