summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Hopf <mhopf@suse.de>2006-03-01 15:48:06 +0000
committerMatthias Hopf <mhopf@suse.de>2006-03-01 15:48:06 +0000
commit17b0d313c80ca754348ca8b92ce117918a2f8d43 (patch)
tree4d29cbff576a4ed90374ccc0b54dac0c26f2522a
parent6729f4df2d314a3573f3da7da3fc364cb48685de (diff)
openSUSE bug #142954 Fixed potential segfault on OOM condition.
-rw-r--r--ChangeLog6
-rw-r--r--greeter/verify.c11
2 files changed, 14 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 74a31f4..0eeca2f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-03-01 Matthias Hopf <mhopf@suse.de>
+
+ * greeter/verify.c: (PAM_conv):
+ openSUSE bug #142954
+ Fixed potential segfault on OOM condition.
+
2006-02-24 Alan Coopersmith <alan.coopersmith@sun.com>
* configure.ac:
diff --git a/greeter/verify.c b/greeter/verify.c
index 47771ac..1e82da2 100644
--- a/greeter/verify.c
+++ b/greeter/verify.c
@@ -1,5 +1,5 @@
/* $Xorg: verify.c,v 1.4 2001/02/09 02:05:41 xorgcvs Exp $ */
-/* $XdotOrg: xc/programs/xdm/greeter/verify.c,v 1.4 2004/10/21 06:03:13 herrb Exp $ */
+/* $XdotOrg: app/xdm/greeter/verify.c,v 1.6 2005/11/08 06:33:32 jkj Exp $ */
/*
Copyright 1988, 1998 The Open Group
@@ -148,10 +148,15 @@ static int PAM_conv (int num_msg,
case PAM_PROMPT_ECHO_OFF:
/* wants password */
if (reply) {
- reply = realloc(reply, size);
+ void *r2 = reply;
+ if (! (reply = realloc(reply, size))) {
+ free (r2);
+ return PAM_CONV_ERR;
+ }
bzero(reply + size - PAM_RESPONSE_SIZE, PAM_RESPONSE_SIZE);
} else {
- reply = (struct pam_response*)malloc(size);
+ if (! (reply = (struct pam_response*)malloc(size)))
+ return PAM_CONV_ERR;
bzero(reply, size);
}