|
@@ -407,8 +407,21 @@ static void http_step ( struct process *process ) {
|
407
|
407
|
|
408
|
408
|
/* Construct authorisation, if applicable */
|
409
|
409
|
if ( user_pw_len ) {
|
410
|
|
- snprintf ( user_pw, sizeof ( user_pw ), "%s:%s",
|
411
|
|
- user, password );
|
|
410
|
+ char *buf = user_pw;
|
|
411
|
+ ssize_t remaining = sizeof ( user_pw );
|
|
412
|
+ size_t len;
|
|
413
|
+
|
|
414
|
+ /* URI-decode the username and password */
|
|
415
|
+ len = uri_decode ( user, buf, remaining );
|
|
416
|
+ buf += len;
|
|
417
|
+ remaining -= len;
|
|
418
|
+ *(remaining--, buf++) = ':';
|
|
419
|
+ len = uri_decode ( password, buf, remaining );
|
|
420
|
+ buf += len;
|
|
421
|
+ remaining -= len;
|
|
422
|
+ assert ( remaining >= 0 );
|
|
423
|
+
|
|
424
|
+ /* Base64-encode the "user:password" string */
|
412
|
425
|
base64_encode ( user_pw, user_pw_base64 );
|
413
|
426
|
}
|
414
|
427
|
|