s3-rpc_server: Fix useless check if we still have a valid string.
authorAndreas Schneider <asn@samba.org>
Mon, 17 Dec 2012 13:40:17 +0000 (14:40 +0100)
committerGünther Deschner <gd@samba.org>
Fri, 21 Dec 2012 12:56:00 +0000 (13:56 +0100)
Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
source3/rpc_server/svcctl/srv_svcctl_reg.c

index 930c327..07b7ce6 100644 (file)
@@ -224,13 +224,13 @@ static bool read_init_file(TALLOC_CTX *mem_ctx,
                p = strstr(str, "Description:");
                if (p != NULL) {
                        char *desc;
+                       size_t len = strlen(p);
 
-                       p += strlen( "Description:" ) + 1;
-                       if (p == NULL) {
+                       if (len <= 12) {
                                break;
                        }
 
-                       desc = svcctl_cleanup_string(mem_ctx, p);
+                       desc = svcctl_cleanup_string(mem_ctx, p + 12);
                        if (desc != NULL) {
                                info->description = talloc_strdup(info, desc);
                        }