]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib: Fix CID 1373623 Dereference after null check
authorVolker Lendecke <vl@samba.org>
Wed, 12 Oct 2016 10:35:12 +0000 (12:35 +0200)
committerKarolin Seeger <kseeger@samba.org>
Fri, 28 Apr 2017 07:10:12 +0000 (09:10 +0200)
We should not overload "p", this is used in the outer loop

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12276
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 6ec81ca3c196f3c4659a4e1c473759b393708d12)

source3/lib/substitute.c

index 1f983274d99dc8970d303ef7835364e3ae641b11..f56e2c4e35f0e21e00cc4e157ddc1a0f198bf865 100644 (file)
@@ -524,9 +524,10 @@ char *talloc_sub_basic(TALLOC_CTX *mem_ctx,
 
                                group_name = gidtoname(pass->pw_gid);
                                if (is_domain_name) {
-                                       p = strchr_m(group_name, *sep);
-                                       if (p != NULL) {
-                                               group_name = p + 1;
+                                       char *group_sep;
+                                       group_sep = strchr_m(group_name, *sep);
+                                       if (group_sep != NULL) {
+                                               group_name = group_sep + 1;
                                        }
                                }
                                a_string = realloc_string_sub(a_string,