git: 9dc80086cde1 - releng/12.2 - Fix libfetch out of bounds read.
Gordon Tetlow
gordon at FreeBSD.org
Tue Aug 24 18:29:37 UTC 2021
The branch releng/12.2 has been updated by gordon:
URL: https://cgit.FreeBSD.org/src/commit/?id=9dc80086cde19485df8947439a12987f56a26c60
commit 9dc80086cde19485df8947439a12987f56a26c60
Author: Gordon Tetlow <gordon at FreeBSD.org>
AuthorDate: 2021-08-24 18:02:27 +0000
Commit: Gordon Tetlow <gordon at FreeBSD.org>
CommitDate: 2021-08-24 18:02:27 +0000
Fix libfetch out of bounds read.
Approved by: so
Security: SA-21:15.libfetch
Security: CVE-2021-36159
---
lib/libfetch/ftp.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/libfetch/ftp.c b/lib/libfetch/ftp.c
index 72165d63fd19..334f9a0ac885 100644
--- a/lib/libfetch/ftp.c
+++ b/lib/libfetch/ftp.c
@@ -704,8 +704,11 @@ ftp_transfer(conn_t *conn, const char *oper, const char *file,
goto ouch;
}
l = (e == FTP_PASSIVE_MODE ? 6 : 21);
- for (i = 0; *p && i < l; i++, p++)
+ for (i = 0; *p && i < l; i++, p++) {
addr[i] = strtol(p, &p, 10);
+ if (*p == '\0' && i < l - 1)
+ break;
+ }
if (i < l) {
e = FTP_PROTOCOL_ERROR;
goto ouch;
More information about the dev-commits-src-all
mailing list