httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yla...@apache.org
Subject svn commit: r1781509 - /httpd/httpd/trunk/support/htpasswd.c
Date Fri, 03 Feb 2017 08:51:49 GMT
Author: ylavic
Date: Fri Feb  3 08:51:49 2017
New Revision: 1781509

URL: http://svn.apache.org/viewvc?rev=1781509&view=rev
Log:
htpasswd: don't point to (unused) stack memory on output
to make static analysers happy.


Modified:
    httpd/httpd/trunk/support/htpasswd.c

Modified: httpd/httpd/trunk/support/htpasswd.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/support/htpasswd.c?rev=1781509&r1=1781508&r2=1781509&view=diff
==============================================================================
--- httpd/httpd/trunk/support/htpasswd.c (original)
+++ httpd/httpd/trunk/support/htpasswd.c Fri Feb  3 08:51:49 2017
@@ -75,15 +75,20 @@ static int mkrecord(struct passwd_ctx *c
 {
     char hash_str[MAX_STRING_LEN];
     int ret;
+
     ctx->out = hash_str;
     ctx->out_len = sizeof(hash_str);
 
     ret = mkhash(ctx);
-    if (ret)
+    if (ret) {
+        ctx->out = NULL;
+        ctx->out_len = 0;
         return ret;
+    }
 
     ctx->out = apr_pstrcat(ctx->pool, user, ":", hash_str, NL, NULL);
-    if (strlen(ctx->out) >= MAX_STRING_LEN) {
+    ctx->out_len = strlen(ctx->out);
+    if (ctx->out_len >= MAX_STRING_LEN) {
         ctx->errstr = "resultant record too long";
         return ERR_OVERFLOW;
     }



Mime
View raw message