diff options
author | Daniel Stenberg <daniel@haxx.se> | 2016-10-08 13:39:29 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2016-10-08 15:13:46 +0200 |
commit | 8238ba9c5f10414a88f502bf3f5d5a42d632984c (patch) | |
tree | eeeb5d93d5435b83f678a54bdffd52d0c287c846 /lib/krb5.c | |
parent | 9885c9508ec757f7f658dab11658e4a3e643a420 (diff) | |
download | curl-8238ba9c5f10414a88f502bf3f5d5a42d632984c.tar.gz |
ftp: fix Curl_ftpsendf()
... it no longer takes printf() arguments since it was only really taken
advantage by one user and it was not written and used in a safe
way. Thus the 'f' is removed from the function name and the proto is
changed.
Although the current code wouldn't end up in badness, it was a risk that
future changes could end up springf()ing too large data or passing in a
format string inadvertently.
Diffstat (limited to 'lib/krb5.c')
-rw-r--r-- | lib/krb5.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/krb5.c b/lib/krb5.c index 87ce8ee6c..5d5c00395 100644 --- a/lib/krb5.c +++ b/lib/krb5.c @@ -182,7 +182,7 @@ krb5_auth(void *app_data, struct connectdata *conn) for(;;) { /* this really shouldn't be repeated here, but can't help it */ if(service == srv_host) { - result = Curl_ftpsendf(conn, "AUTH GSSAPI"); + result = Curl_ftpsend(conn, "AUTH GSSAPI"); if(result) return -2; @@ -243,16 +243,22 @@ krb5_auth(void *app_data, struct connectdata *conn) } if(output_buffer.length != 0) { + char *cmd; + result = Curl_base64_encode(data, (char *)output_buffer.value, output_buffer.length, &p, &base64_sz); if(result) { Curl_infof(data, "base64-encoding: %s\n", curl_easy_strerror(result)); - ret = AUTH_CONTINUE; + ret = AUTH_ERROR; break; } - result = Curl_ftpsendf(conn, "ADAT %s", p); + cmd = aprintf("ADAT %s", p); + if(cmd) + result = Curl_ftpsend(conn, cmd); + else + result = CURLE_OUT_OF_MEMORY; free(p); |