From 71258bb5c7192740b80077c1131c1ffd5ba6ab4e Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Fri, 1 Feb 2013 19:33:59 +0100 Subject: [PATCH] afpd/fce_api: avoid null pointer dereference Move path NULL check before it is actually referenced. Reported by Coverity as CID #968570. --- etc/afpd/fce_api.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/etc/afpd/fce_api.c b/etc/afpd/fce_api.c index 49dd3cd7..36cce446 100644 --- a/etc/afpd/fce_api.c +++ b/etc/afpd/fce_api.c @@ -361,9 +361,10 @@ int fce_register(fce_ev_t event, const char *path, const char *oldpath, fce_obj_ return AFP_OK; AFP_ASSERT(event >= FCE_FIRST_EVENT && event <= FCE_LAST_EVENT); + AFP_ASSERT(path); LOG(log_debug, logtype_fce, "register_fce(path: %s, type: %s, event: %s", - path , type == fce_dir ? "dir" : "file", fce_event_names[event]); + path, type == fce_dir ? "dir" : "file", fce_event_names[event]); bname = basename_safe(path); @@ -371,8 +372,6 @@ int fce_register(fce_ev_t event, const char *path, const char *oldpath, fce_obj_ /* No listeners configured */ return AFP_OK; - if (path == NULL) - return AFPERR_PARAM; /* do some initialization on the fly the first time */ if (first_event) { -- 2.39.2