http_negotiate: Fix int* vs. size_t* type mismatch
commited6a33d318eba9315dc468d65ef06b3712c545a8
authorKalle Olavi Niemitalo <kon@iki.fi>
Fri, 26 Oct 2012 12:20:32 +0000 (26 15:20 +0300)
committerKalle Olavi Niemitalo <Kalle@Niukka.kon.iki.fi>
Sat, 3 Nov 2012 21:01:29 +0000 (3 23:01 +0200)
tree36e61fb791f06dc27620b2d7b176e39a63bc9d5d
parent1cba6b46e53be202490c94c7ea5486b3ff239317
http_negotiate: Fix int* vs. size_t* type mismatch

http_negotiate_parse_data passed &token->length as the int *outlen
parameter of base64_decode_bin, which stores an int at that location.
However, gss_buffer_desc::length is size_t in all implementations that
I checked: MIT Kerberos Version 5 Release 1.10, libgssglue 0.4, and
GNU GSS 1.0.2.  This mismatch could cause the build to fail:

.../src/protocol/http/http_negotiate.c: In function ‘http_negotiate_parse_data’:
.../src/protocol/http/http_negotiate.c:173:2: error: passing argument 3 of ‘base64_decode_bin’ from incompatible pointer type [-Werror]
In file included from .../src/protocol/http/http_negotiate.c:30:0:
.../src/util/base64.h:8:16: note: expected ‘int *’ but argument is of type ‘size_t *’

On 64-bit big-endian hosts, it might also cause the GSSAPI
implementation to read too much data from memory and disclose it to
some network server, or crash ELinks.
(cherry picked from elinks-0.12 commit d33c807dd97ddab534b22bd4ad3c93b44fbd5916)
src/protocol/http/http_negotiate.c