summaryrefslogtreecommitdiff
path: root/source4/heimdal/lib/asn1/extra.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2006-03-11 04:03:12 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:56:58 -0500
commitb7afac2b834674e20f303c3a03b4ac7bb283695e (patch)
tree4828afb0cf5bc89f0063d3225d0f15cc01cd2012 /source4/heimdal/lib/asn1/extra.c
parent64b619cefe99c833297f2a635db06bd186843481 (diff)
downloadsamba-b7afac2b834674e20f303c3a03b4ac7bb283695e.tar.gz
samba-b7afac2b834674e20f303c3a03b4ac7bb283695e.tar.bz2
samba-b7afac2b834674e20f303c3a03b4ac7bb283695e.zip
r14198: Update Samba4 to current lorikeet-heimdal.
Andrew Bartlett (This used to be commit 97a0a0e2fa6784e5fc5278f7a15b385ddcb6a3b3)
Diffstat (limited to 'source4/heimdal/lib/asn1/extra.c')
-rw-r--r--source4/heimdal/lib/asn1/extra.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/source4/heimdal/lib/asn1/extra.c b/source4/heimdal/lib/asn1/extra.c
index ba081e3a63..4f70f191df 100644
--- a/source4/heimdal/lib/asn1/extra.c
+++ b/source4/heimdal/lib/asn1/extra.c
@@ -34,7 +34,7 @@
#include "der_locl.h"
#include "heim_asn1.h"
-RCSID("$Id: extra.c,v 1.5 2005/07/19 18:05:16 lha Exp $");
+RCSID("$Id: extra.c,v 1.6 2006/01/31 09:44:54 lha Exp $");
int
encode_heim_any(unsigned char *p, size_t len,
@@ -59,10 +59,7 @@ decode_heim_any(const unsigned char *p, size_t len,
unsigned int thistag;
int e;
- if (data == NULL && len == 0) { /* XXX tag less OPTIONAL */
- *size = 0;
- return 0;
- }
+ memset(data, 0, sizeof(*data));
e = der_get_tag (p, len, &thisclass, &thistype, &thistag, &l);
if (e) return e;
@@ -73,16 +70,15 @@ decode_heim_any(const unsigned char *p, size_t len,
if (length + len_len + l > len)
return ASN1_OVERFLOW;
- if (data) { /* XXX hack to workaround tag less OPTIONAL data */
- memset(data, 0, sizeof(*data));
-
- data->data = malloc(length + len_len + l);
- if (data->data == NULL)
- return ENOMEM;
- data->length = length + len_len + l;
- memcpy(data->data, p, length + len_len + l);
- }
- if (size) *size = length + len_len + l;
+ data->data = malloc(length + len_len + l);
+ if (data->data == NULL)
+ return ENOMEM;
+ data->length = length + len_len + l;
+ memcpy(data->data, p, length + len_len + l);
+
+ if (size)
+ *size = length + len_len + l;
+
return 0;
}