All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rt-tests: rt-utils: Fix potential 'debugfileprefix' overflow
@ 2022-06-29 17:51 Ian K. Coolidge
  0 siblings, 0 replies; only message in thread
From: Ian K. Coolidge @ 2022-06-29 17:51 UTC (permalink / raw)
  To: jkacur, williams; +Cc: linux-rt-users, Ian K. Coolidge

fscanf on line 73 amounts to
fscanf(fp, "... %256s ...", debugfileprefix)

This can result in 256 characters excluding nul.

Add 1 to buffer size to accomodate a maximum write + a nul.

Signed-off-by: Ian K. Coolidge <icoolidge@google.com>
---
 src/lib/rt-utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lib/rt-utils.c b/src/lib/rt-utils.c
index 6c0235d..bbc0b82 100644
--- a/src/lib/rt-utils.c
+++ b/src/lib/rt-utils.c
@@ -32,7 +32,7 @@
 #define  MAX_COMMAND_LINE 4096
 #define  MAX_TS_SIZE 64
 
-static char debugfileprefix[MAX_PATH];
+static char debugfileprefix[MAX_PATH + 1];
 static char *fileprefix;
 static int trace_fd = -1;
 static int tracemark_fd = -1;
-- 
2.37.0.rc0.161.g10f37bed90-goog


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-29 17:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-29 17:51 [PATCH] rt-tests: rt-utils: Fix potential 'debugfileprefix' overflow Ian K. Coolidge

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.