s3-vfs: Do not deref a NULL pointer in shadow_copy2_snapshot_to_gmt()
authorAndreas Schneider <asn@samba.org>
Thu, 16 Feb 2017 16:15:38 +0000 (17:15 +0100)
committerJeremy Allison <jra@samba.org>
Thu, 23 Feb 2017 02:18:10 +0000 (03:18 +0100)
Found by covscan.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12592

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/modules/vfs_shadow_copy2.c

index 402eb70936b3c54a95f86023085bcb46c33e02a1..2afc5954e7d26f5a4cc8b681c378e8f87d89e263 100644 (file)
@@ -1873,6 +1873,9 @@ static bool shadow_copy2_snapshot_to_gmt(vfs_handle_struct *handle,
                }
                /* Extract the prefix */
                tmp = strstr(tmpstr, priv->config->delimiter);
+               if (tmp == NULL) {
+                       goto done;
+               }
                *tmp = '\0';
 
                /* Parse regex */