No, i dont think you missed something. It's just one of the many false positive reported by cppcheck. I tested replacing the PATH_MAX value by a static value and the reported error disappeared...
On Sun, May 18, 2014 at 1:34 AM, Christophe <christophe.cu...@free.fr> wrote: > I checked, Coverity did not report anything. > > The more I look at the code, the less I understand what cppcheck is > complaining about. > The first thing done is to snprintf into that buffer (path), so it gets > initialised, and it does not care what was in previously. The only reason we > could have a problem is when sizeof(path) <= 0 (then the behaviour of > snprintf is undefined), which I believe is a bit unlikely. > > Did I miss something? > > > ----- David Maciejak <david.macie...@gmail.com> a écrit : >> Sure, as you may come with a better idea i am ok with that. >> btw i believe coverity reported the same kind of problems. >> So it's just to be sure we can handle them. >> >> regards, >> david >> >> On Sun, May 18, 2014 at 12:52 AM, Christophe <christophe.cu...@free.fr> >> wrote: >> > >> > May I suggest to not get this patch? This is not the correct way to fix >> > the problem reported by cppcheck. >> > >> > >> > ----- David Maciejak <david.macie...@gmail.com> a écrit : >> >> set default path init value to remove some cppcheck warning >> >> >> >> --- >> >> src/defaults.c | 2 +- >> >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> >> >> diff --git a/src/defaults.c b/src/defaults.c >> >> index 7d66372..c6748d5 100644 >> >> --- a/src/defaults.c >> >> +++ b/src/defaults.c >> >> @@ -798,7 +798,7 @@ static void initDefaults(void) >> >> static WMPropList *readGlobalDomain(const char *domainName, Bool >> >> requireDictionary) >> >> { >> >> WMPropList *globalDict = NULL; >> >> - char path[PATH_MAX]; >> >> + char path[PATH_MAX] = ""; >> >> struct stat stbuf; >> >> >> >> snprintf(path, sizeof(path), "%s/%s/%s", SYSCONFDIR, >> >> GLOBAL_DEFAULTS_SUBDIR, domainName); >> >> -- >> >> 1.8.3.2 >> > >> > >> > -- >> > To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org. > > > -- > To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org. -- To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.