mirror of
https://github.com/openwrt/openwrt.git
synced 2025-02-19 17:07:17 +00:00
This backports a fix from dropbear 2020.81. CVE-2020-36254 description: scp.c in Dropbear before 2020.79 mishandles the filename of . or an empty filename, a related issue to CVE-2018-20685. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
22 lines
700 B
Diff
22 lines
700 B
Diff
From 8f8a3dff705fad774a10864a2e3dbcfa9779ceff Mon Sep 17 00:00:00 2001
|
|
From: Haelwenn Monnier <contact+github.com@hacktivis.me>
|
|
Date: Mon, 25 May 2020 14:54:29 +0200
|
|
Subject: [PATCH] scp.c: Port OpenSSH CVE-2018-20685 fix (#80)
|
|
|
|
---
|
|
scp.c | 3 ++-
|
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
|
--- a/scp.c
|
|
+++ b/scp.c
|
|
@@ -935,7 +935,8 @@ sink(int argc, char **argv)
|
|
size = size * 10 + (*cp++ - '0');
|
|
if (*cp++ != ' ')
|
|
SCREWUP("size not delimited");
|
|
- if ((strchr(cp, '/') != NULL) || (strcmp(cp, "..") == 0)) {
|
|
+ if (*cp == '\0' || strchr(cp, '/') != NULL ||
|
|
+ strcmp(cp, ".") == 0 || strcmp(cp, "..") == 0) {
|
|
run_err("error: unexpected filename: %s", cp);
|
|
exit(1);
|
|
}
|