summaryrefslogtreecommitdiffstats
path: root/lib/libalpm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/dload.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index e786a3c0..6f0139d1 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -135,9 +135,15 @@ static int curl_gethost(const char *url, char *buffer)
p += 2; /* jump over the found // */
hostlen = strcspn(p, "/");
- /* there might be a user:pass@ on the URL. hide it. */
- q = memrchr(p, '@', hostlen);
- if(q) {
+ /* there might be a user:pass@ on the URL. hide it. avoid using memrchr()
+ * for portability concerns. */
+ q = p + hostlen;
+ while(--q > p) {
+ if(*q == '@') {
+ break;
+ }
+ }
+ if(*q == '@' && p != q) {
hostlen -= q - p + 1;
p = q + 1;
}