From: Kim W. <ki...@wo...> - 2004-12-17 19:03:38
|
Frederick Heckel wrote: > I'm a longtime fan of Enlightenment, just waiting for DR17. I did a > CVS ebuild on my Gentoo system yesterday, and have tried out Engage. > It's very nice, except for one thing: when I try to actually setup > any launcher icons, it segfaults. > > Running a gdb trace, it was segfaulting in strcmp. Looking through > the code, I saw an awful lot of strcmps and strcpys. My question is, > what is this family of string functions being used? They're just > inviting memory errors like the seg fault I'm getting. Is there > really any reason to not just be safe and use the strn functions > instead? > strncmp cannot simply replace strcmp. There isn't even any point in doing so for the reason mentioned here. Segv in strcmp is typically because one of the pointers is invalid or NULL, and strncmp will most likely segv in exactly the same way. strcpy/strncpy is an entirely different matter as they potentially overflow the destination buffer. /Kim |