[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-mailutils] mailx: password displayed as part of URL
From: |
Sergey Poznyakoff |
Subject: |
Re: [bug-mailutils] mailx: password displayed as part of URL |
Date: |
Sun, 01 Mar 2009 17:26:18 +0200 |
Hi Paul,
Please find attached a quick fix.
Regards,
Sergey
diff --git a/mailbox/url.c b/mailbox/url.c
index 3bbea29..570f629 100644
--- a/mailbox/url.c
+++ b/mailbox/url.c
@@ -303,6 +303,25 @@ mu_url_parse (mu_url_t url)
u.X = NULL; \
}
+ /* Blank out passwd part of the original URL */
+ if (u.passwd)
+ {
+#define PASS_REPL "(censored)"
+#define PASS_REPL_LEN (sizeof (PASS_REPL) - 1)
+ size_t plen = strlen (u.passwd);
+ size_t pstart = u.passwd - n;
+ size_t nlen = strlen (url->name);
+ size_t len = nlen - plen + PASS_REPL_LEN + 1;
+ char *newname = realloc (url->name, len);
+ if (!newname)
+ goto CLEANUP;
+
+ memmove (newname + pstart + PASS_REPL_LEN, newname + pstart + plen,
+ nlen - (pstart + plen) + 1);
+ memcpy (newname + pstart, PASS_REPL, PASS_REPL_LEN);
+ url->name = newname;
+ }
+
UALLOC (scheme);
UALLOC (user);
UALLOC (passwd);
@@ -318,6 +337,7 @@ mu_url_parse (mu_url_t url)
url->qargv = u.qargv;
url->port = u.port;
+
}
CLEANUP: