summaryrefslogtreecommitdiff
path: root/source4/auth/gensec
diff options
context:
space:
mode:
Diffstat (limited to 'source4/auth/gensec')
-rw-r--r--source4/auth/gensec/spnego_parse.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/source4/auth/gensec/spnego_parse.c b/source4/auth/gensec/spnego_parse.c
index c768d1e847..5382402206 100644
--- a/source4/auth/gensec/spnego_parse.c
+++ b/source4/auth/gensec/spnego_parse.c
@@ -265,7 +265,7 @@ static BOOL write_negTokenTarg(struct asn1_data *asn1, struct spnego_negTokenTar
ssize_t spnego_read_data(TALLOC_CTX *mem_ctx, DATA_BLOB data, struct spnego_data *token)
{
- struct asn1_data *asn1 = asn1_init(mem_ctx);
+ struct asn1_data *asn1;
ssize_t ret = -1;
uint8_t context;
@@ -275,6 +275,11 @@ ssize_t spnego_read_data(TALLOC_CTX *mem_ctx, DATA_BLOB data, struct spnego_data
return ret;
}
+ asn1 = asn1_init(mem_ctx);
+ if (asn1 == NULL) {
+ return -1;
+ }
+
asn1_load(asn1, data);
if (!asn1_peek_uint8(asn1, &context)) {
@@ -311,6 +316,10 @@ ssize_t spnego_write_data(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, struct spnego_da
struct asn1_data *asn1 = asn1_init(mem_ctx);
ssize_t ret = -1;
+ if (asn1 == NULL) {
+ return -1;
+ }
+
switch (spnego->type) {
case SPNEGO_NEG_TOKEN_INIT:
asn1_push_tag(asn1, ASN1_APPLICATION(0));