Don't fetch files larger than 2MB
authorjob <job@openbsd.org>
Thu, 28 Oct 2021 13:50:29 +0000 (13:50 +0000)
committerjob <job@openbsd.org>
Thu, 28 Oct 2021 13:50:29 +0000 (13:50 +0000)
OK claudio@

usr.sbin/rpki-client/rsync.c

index a1bdd7f..bc711f1 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: rsync.c,v 1.28 2021/10/23 20:01:16 claudio Exp $ */
+/*     $OpenBSD: rsync.c,v 1.29 2021/10/28 13:50:29 job Exp $ */
 /*
  * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
  *
@@ -33,6 +33,9 @@
 
 #include "extern.h"
 
+#define        __STRINGIFY(x)  #x
+#define        STRINGIFY(x)    __STRINGIFY(x)
+
 /*
  * A running rsync process.
  * We can have multiple of these simultaneously and need to keep track
@@ -275,6 +278,7 @@ proc_rsync(char *prog, char *bind_addr, int fd)
                        args[i++] = (char *)prog;
                        args[i++] = "-rt";
                        args[i++] = "--no-motd";
+                       args[i++] = "--max-size=" STRINGIFY(MAX_FILE_SIZE);
                        args[i++] = "--timeout=180";
                        args[i++] = "--include=*/";
                        args[i++] = "--include=*.cer";