]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Use 'ap_pbase64decode' to simplify code.
authorChristophe Jaillet <jailletc36@apache.org>
Sat, 28 Nov 2015 06:53:46 +0000 (06:53 +0000)
committerChristophe Jaillet <jailletc36@apache.org>
Sat, 28 Nov 2015 06:53:46 +0000 (06:53 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1716940 13f79535-47bb-0310-9956-ffa450edef68

modules/aaa/mod_auth_basic.c

index 3e3da35dbc7ae8cdde19a9315b042fb959c33443..d0986940099e23aa63e0576b594004f48ac54ec5 100644 (file)
@@ -250,7 +250,6 @@ static int get_basic_auth(request_rec *r, const char **user,
 {
     const char *auth_line;
     char *decoded_line;
-    int length;
 
     /* Get the appropriate header */
     auth_line = apr_table_get(r->headers_in, (PROXYREQ_PROXY == r->proxyreq)
@@ -275,10 +274,7 @@ static int get_basic_auth(request_rec *r, const char **user,
         auth_line++;
     }
 
-    decoded_line = apr_palloc(r->pool, apr_base64_decode_len(auth_line) + 1);
-    length = apr_base64_decode(decoded_line, auth_line);
-    /* Null-terminate the string. */
-    decoded_line[length] = '\0';
+    decoded_line = ap_pbase64decode(r->pool, auth_line);
 
     *user = ap_getword_nulls(r->pool, (const char**)&decoded_line, ':');
     *pw = decoded_line;