aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2022-11-10 12:16:29 +0200
committerIgor Pashev <pashev.igor@gmail.com>2022-11-10 12:20:02 +0200
commit5ecd590481ef7da30067eea6a3cb45bf17b2f6ce (patch)
tree628a23ec90ee85a44f519a3934db888d69c9d051
parent3b4a77a948c87a155b7f4cba1db752964fbe4157 (diff)
downloadtcp-master.tar.gz
Reject long file namesHEADmaster
-rw-r--r--server.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/server.c b/server.c
index 6c6cdf8..664e171 100644
--- a/server.c
+++ b/server.c
@@ -54,6 +54,12 @@ recvfile (int fd)
goto clean;
}
+ if (!memchr (buf, 0, PATH_MAX))
+ {
+ warning ("filename is too long");
+ goto clean;
+ }
+
/* XXX no subdirs. */
filename = strndup (buf, PATH_MAX);
if (!filename)