Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Jan 2020 18:42:06 +0000 (UTC)
From:      Gordon Tetlow <gordon@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r357214 - stable/11/lib/libfetch
Message-ID:  <202001281842.00SIg6so030090@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gordon
Date: Tue Jan 28 18:42:06 2020
New Revision: 357214
URL: https://svnweb.freebsd.org/changeset/base/357214

Log:
  MFC 357212.
  
  Fix urldecode buffer overrun.
  
  Reported by:    Duncan Overbruck
  Approved by:    so
  Security:       FreeBSD-SA-20:01.libfetch
  Security:       CVE-2020-7450

Modified:
  stable/11/lib/libfetch/fetch.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libfetch/fetch.c
==============================================================================
--- stable/11/lib/libfetch/fetch.c	Tue Jan 28 18:40:55 2020	(r357213)
+++ stable/11/lib/libfetch/fetch.c	Tue Jan 28 18:42:06 2020	(r357214)
@@ -328,6 +328,8 @@ fetch_pctdecode(char *dst, const char *src, size_t dle
 		}
 		if (dlen-- > 0)
 			*dst++ = c;
+		else
+			return (NULL);
 	}
 	return (s);
 }
@@ -375,11 +377,15 @@ fetchParseURL(const char *URL)
 	if (p && *p == '@') {
 		/* username */
 		q = fetch_pctdecode(u->user, URL, URL_USERLEN);
+		if (q == NULL)
+			goto ouch;
 
 		/* password */
-		if (*q == ':')
+		if (*q == ':') {
 			q = fetch_pctdecode(u->pwd, q + 1, URL_PWDLEN);
-
+			if (q == NULL)
+				goto ouch;
+		}
 		p++;
 	} else {
 		p = URL;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202001281842.00SIg6so030090>