aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjohannst <johannes.stoelp@gmail.com>2021-03-14 21:08:25 +0100
committerjohannst <johannes.stoelp@gmail.com>2021-03-14 21:08:25 +0100
commit877b4b9889a3ba5e935373580fefaf9d747001ec (patch)
treec44c5a934ab67ddee78f3ce36f90edaec643cecf
parente2e53897fe0d9d701622bec857e356be11d9c4f2 (diff)
downloaddynld-877b4b9889a3ba5e935373580fefaf9d747001ec.tar.gz
dynld-877b4b9889a3ba5e935373580fefaf9d747001ec.zip
pfmt: added upper limit for stack local buffer
-rw-r--r--include/io.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/include/io.h b/include/io.h
index d9a1ae1..4f61cbf 100644
--- a/include/io.h
+++ b/include/io.h
@@ -8,15 +8,17 @@
#include <asm/unistd.h>
// `pfmt` uses fixed-size buffer on the stack for formating the message
-// (since we don't impl buffered I/O).
+// (for simplicity and since we don't impl buffered I/O).
//
// Size can be re-configured by defining `MAX_PRINTF_LEN` before including
// `io.h`.
//
-// NOTE: This allows to specify an arbitrarily large buffer on the stack, but
-// for the purpose of this study that's fine, we are cautious.
+// NOTE: This allows to specify a large buffer on the stack, but for
+// the purpose of this study that's fine, we are cautious.
#if !defined(MAX_PRINTF_LEN)
# define MAX_PRINTF_LEN 128
+#elif MAX_PRINTF_LEN > 512
+# error MAX_PRINTF_LEN is limited by 512!
#endif
#define FD_STDOUT 1