crash using library-allocated storage for header in wrap_iov
authorKen Raeburn <raeburn@mit.edu>
Thu, 12 Mar 2009 16:48:15 +0000 (16:48 +0000)
committerKen Raeburn <raeburn@mit.edu>
Thu, 12 Mar 2009 16:48:15 +0000 (16:48 +0000)
When allocating storage for the header buffer, update the internal
output buffer pointer as well.

ticket: 6412
target_version: 1.7
tags: pullup

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

src/lib/gssapi/krb5/k5sealv3iov.c

index 98904b62d7bf48445025a496ae5c566e66d96d8b..85f9036b30151457d82f6dc5a357fa81777a979d 100644 (file)
@@ -129,9 +129,10 @@ gss_krb5int_make_seal_token_v3_iov(krb5_context context,
             gss_headerlen += gss_trailerlen;
         }
 
-        if (header->type & GSS_IOV_BUFFER_FLAG_ALLOCATE)
+        if (header->type & GSS_IOV_BUFFER_FLAG_ALLOCATE) {
             code = kg_allocate_iov(header, (size_t) gss_headerlen);
-        else if (header->buffer.length < gss_headerlen)
+            outbuf = (unsigned char *)header->buffer.value;
+        } else if (header->buffer.length < gss_headerlen)
             code = KRB5_BAD_MSIZE;
         if (code != 0)
             goto cleanup;