From ab83710deb7b7b60c1fc3bdaaf6b2d4e7f062558 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Wed, 8 Feb 2012 11:00:49 -0500 Subject: gp_conv: Allow null oids as input in conversion functions --- proxy/src/gp_conv.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/proxy/src/gp_conv.c b/proxy/src/gp_conv.c index 0105d00..486c727 100644 --- a/proxy/src/gp_conv.c +++ b/proxy/src/gp_conv.c @@ -82,6 +82,11 @@ int gp_conv_octet_string_alloc(size_t length, void *value, void gp_conv_gssx_to_oid(gssx_OID *in, gss_OID out) { + if (in == NULL) { + out->length = 0; + out->elements = NULL; + return; + } out->length = in->octet_string_len; out->elements = (void *)in->octet_string_val; } @@ -108,11 +113,18 @@ int gp_conv_gssx_to_oid_alloc(gssx_OID *in, gss_OID *out) int gp_conv_oid_to_gssx(gss_OID in, gssx_OID *out) { + if (in == GSS_C_NO_OID) { + return gp_conv_octet_string(0, NULL, out); + } return gp_conv_octet_string(in->length, in->elements, out); } int gp_conv_oid_to_gssx_alloc(gss_OID in, gssx_OID **out) { + if (in == GSS_C_NO_OID) { + *out = NULL; + return 0; + } return gp_conv_octet_string_alloc(in->length, in->elements, out); } -- cgit