memory leak if defective header present in gss_krb5int_unseal_token_v3
authorEzra Peisach <epeisach@mit.edu>
Sat, 30 Dec 2006 06:05:12 +0000 (06:05 +0000)
committerEzra Peisach <epeisach@mit.edu>
Sat, 30 Dec 2006 06:05:12 +0000 (06:05 +0000)
If after unsealing the message, the TOK_ID is not 05 04, free memory
before returning a defective token error.

ticket: new
tags: pullup

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19021 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/gssapi/krb5/k5sealv3.c

index c5628e2c2883fdbe5a71821ed8c47573b5cb6f7a..d83ac8593c8473d07dae9ca605696ee263cce074 100644 (file)
@@ -412,8 +412,10 @@ gss_krb5int_unseal_token_v3(krb5_context *contextptr,
            if (load_16_be(althdr) != 0x0504
                || althdr[2] != ptr[2]
                || althdr[3] != ptr[3]
-               || memcmp(althdr+8, ptr+8, 8))
+               || memcmp(althdr+8, ptr+8, 8)) {
+               free(plain.data);
                goto defective;
+           }
            message_buffer->value = plain.data;
            message_buffer->length = plain.length - ec - 16;
        } else {