summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/lib/system.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/source3/lib/system.c b/source3/lib/system.c
index 0bd1fea140..5a5f853bda 100644
--- a/source3/lib/system.c
+++ b/source3/lib/system.c
@@ -557,6 +557,13 @@ struct passwd *copy_passwd_struct(struct passwd *pass)
return NULL;
}
+ if (pass == &pw_ret)
+ {
+ /* catch silly error where buffer was already copied */
+ DEBUG(0,("copy_passwd_struct: can't copy internal buffer!\n"));
+ return NULL;
+ }
+
memcpy((char *)&pw_ret, pass, sizeof(struct passwd));
if (pass->pw_name)