1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 15:48:49 -05:00

krb5: use private buffer for temp string, not receive buffer

This commit is contained in:
Daniel Stenberg 2017-04-25 14:37:45 +02:00
parent 89cf6f38d2
commit c79f4908d4

View File

@ -164,6 +164,7 @@ krb5_auth(void *app_data, struct connectdata *conn)
size_t base64_sz = 0;
struct sockaddr_in **remote_addr =
(struct sockaddr_in **)&conn->ip_addr->ai_addr;
char *stringp;
if(getsockname(conn->sock[FIRSTSOCKET],
(struct sockaddr *)&conn->local_addr, &l) < 0)
@ -193,16 +194,19 @@ krb5_auth(void *app_data, struct connectdata *conn)
return -1;
}
input_buffer.value = data->state.buffer;
input_buffer.length = snprintf(input_buffer.value, BUFSIZE, "%s@%s",
service, host);
stringp = aprintf("%s@%s", service, host);
if(!stringp)
return -2;
input_buffer.value = stringp;
input_buffer.length = strlen(stringp);
maj = gss_import_name(&min, &input_buffer, GSS_C_NT_HOSTBASED_SERVICE,
&gssname);
free(stringp);
if(maj != GSS_S_COMPLETE) {
gss_release_name(&min, &gssname);
if(service == srv_host) {
Curl_failf(data, "Error importing service name %s",
input_buffer.value);
Curl_failf(data, "Error importing service name %s@%s", service, host);
return AUTH_ERROR;
}
service = srv_host;