]> arthur.barton.de Git - netatalk.git/commitdiff
afpd/fce_api: avoid null pointer dereference
authorRiccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
Fri, 1 Feb 2013 18:33:59 +0000 (19:33 +0100)
committerRiccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
Sat, 9 Feb 2013 09:24:51 +0000 (10:24 +0100)
Move path NULL check before it is actually referenced.

Reported by Coverity as CID #968570.

etc/afpd/fce_api.c

index 49dd3cd7d4d5b367616213ca9975a803f42ab046..36cce446645883bd42214deb765609094a85dbe3 100644 (file)
@@ -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) {