From c7303e53f0833f8bc09f7117d3d865aa9835ee2b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20Kou=C5=99il?= Date: Wed, 13 Jun 2012 08:27:24 +0000 Subject: [PATCH] specify proper length of strings (GGUS #82746) (taken from HEAD) --- org.glite.lbjp-common.gss/src/glite_gss.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/org.glite.lbjp-common.gss/src/glite_gss.c b/org.glite.lbjp-common.gss/src/glite_gss.c index b35d82e..be8a932 100644 --- a/org.glite.lbjp-common.gss/src/glite_gss.c +++ b/org.glite.lbjp-common.gss/src/glite_gss.c @@ -747,13 +747,13 @@ edg_wll_gss_acquire_cred_gsi(const char *cert_file, const char *key_file, edg_wl goto end; } - asprintf((char**)&buffer.value, "X509_USER_PROXY=%s", proxy_file); - if (buffer.value == NULL) { + ret = asprintf((char**)&buffer.value, "X509_USER_PROXY=%s", proxy_file); + if (ret == -1) { errno = ENOMEM; ret = EDG_WLL_GSS_ERROR_ERRNO; goto end; } - buffer.length = strlen(proxy_file); + buffer.length = ret; major_status = gss_import_cred(&minor_status, &gss_cred, GSS_C_NO_OID, 1, @@ -948,9 +948,9 @@ edg_wll_gss_connect_ext(edg_wll_GssCred cred, char const *hostname, int port, gss_buffer_desc input_token = GSS_C_EMPTY_BUFFER; int ret; - asprintf(&servername, "%s@%s", + ret = asprintf(&servername, "%s@%s", (service) ? service : "host", hostname); - if (servername == NULL) { + if (ret == -1) { errno = ENOMEM; return EDG_WLL_GSS_ERROR_ERRNO; } -- 1.8.2.3