44 lines
1.6 KiB
Diff
44 lines
1.6 KiB
Diff
From 4ceed9a85484bdde3d355d21ceb666dc8d910910 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gdeschner@redhat.com>
|
|
Date: Wed, 22 May 2013 17:26:00 +0200
|
|
Subject: [PATCH] Fix realloc size in gp_get_cred_environment().
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
This fixes a segfault when no client_keytab is passed in via cred_store api.
|
|
See https://fedorahosted.org/gss-proxy/ticket/85 for details.
|
|
|
|
Signed-off-by: Günther Deschner <gdeschner@redhat.com>
|
|
Reviewed-by: Simo Sorce <simo@redhat.com>
|
|
---
|
|
proxy/src/gp_creds.c | 5 +++--
|
|
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/proxy/src/gp_creds.c b/proxy/src/gp_creds.c
|
|
index 0dd54f0..2517665 100644
|
|
--- a/proxy/src/gp_creds.c
|
|
+++ b/proxy/src/gp_creds.c
|
|
@@ -292,7 +292,8 @@ static int gp_get_cred_environment(struct gp_service *svc,
|
|
} else {
|
|
gss_key_value_element_desc *t;
|
|
c = cs->count;
|
|
- t = realloc(cs->elements, c + 1);
|
|
+ t = realloc(cs->elements,
|
|
+ (c + 1) * sizeof(gss_key_value_element_desc));
|
|
if (!t) {
|
|
ret = ENOMEM;
|
|
goto done;
|
|
@@ -304,7 +305,7 @@ static int gp_get_cred_environment(struct gp_service *svc,
|
|
goto done;
|
|
}
|
|
|
|
- /* increment now so in case of failure to opy the value, key is
|
|
+ /* increment now so in case of failure to copy the value, key is
|
|
* still freed properly */
|
|
cs->count = c + 1;
|
|
cs->elements[c].value = strdup(cs->elements[k_num].value);
|
|
--
|
|
1.8.1.4
|
|
|