[krbdev.mit.edu #5233] Change in behaviour in gss_release_buffer() by mechtypes introduces memory leak

Ezra Peisach via RT rt-comment at krbdev.mit.edu
Fri Dec 29 18:17:56 EST 2006


Well - here is my patch.... Appears to work w/o complaint w/ gssftp....


Included is another memory leak patch - on error case....

Index: krb5/k5sealv3.c
===================================================================
--- krb5/k5sealv3.c     (revision 19019)
+++ krb5/k5sealv3.c     (working copy)
@@ -412,10 +412,16 @@
            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;
+           if(message_buffer->length == 0) {
+             free(message_buffer->value);
+             message_buffer->value = NULL;
+           }
        } else {
            /* no confidentiality */
            if (conf_state)





More information about the krb5-bugs mailing list