diff options
| author | Michael Brown | 2010-05-28 02:17:22 +0200 |
|---|---|---|
| committer | Michael Brown | 2010-05-28 13:44:23 +0200 |
| commit | dfcce165a58dc3be7d1c6c1bdf80dd6a28d50d7f (patch) | |
| tree | 202eb2047d2c7da2f8e7a0ea71daa6f35c03a4c5 /src/net/tcp | |
| parent | [doc] Re-add README file (diff) | |
| download | ipxe-dfcce165a58dc3be7d1c6c1bdf80dd6a28d50d7f.tar.gz ipxe-dfcce165a58dc3be7d1c6c1bdf80dd6a28d50d7f.tar.xz ipxe-dfcce165a58dc3be7d1c6c1bdf80dd6a28d50d7f.zip | |
[base64] Allow base64_encode() to handle arbitrary data
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/net/tcp')
| -rw-r--r-- | src/net/tcp/http.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/net/tcp/http.c b/src/net/tcp/http.c index c7027d2d0..5faffe99d 100644 --- a/src/net/tcp/http.c +++ b/src/net/tcp/http.c @@ -424,7 +424,7 @@ static void http_step ( struct process *process ) { size_t user_pw_len = ( user ? ( strlen ( user ) + 1 /* ":" */ + strlen ( password ) ) : 0 ); size_t user_pw_base64_len = base64_encoded_len ( user_pw_len ); - char user_pw[ user_pw_len + 1 /* NUL */ ]; + uint8_t user_pw[ user_pw_len + 1 /* NUL */ ]; char user_pw_base64[ user_pw_base64_len + 1 /* NUL */ ]; int rc; int request_len = unparse_uri ( NULL, 0, http->uri, @@ -443,11 +443,11 @@ static void http_step ( struct process *process ) { /* Construct authorisation, if applicable */ if ( user ) { /* Make "user:password" string from decoded fields */ - snprintf ( user_pw, sizeof ( user_pw ), "%s:%s", - user, password ); + snprintf ( ( ( char * ) user_pw ), sizeof ( user_pw ), + "%s:%s", user, password ); /* Base64-encode the "user:password" string */ - base64_encode ( user_pw, user_pw_base64 ); + base64_encode ( user_pw, user_pw_len, user_pw_base64 ); } /* Send GET request */ |
