diff options
author | Christian Brabandt <cb@256bit.org> | 2023-11-29 11:34:05 +0100 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2023-12-01 18:58:51 +0100 |
commit | b39b240c386a5a29241415541f1c99e2e6b8ce47 (patch) | |
tree | 25ac23d0f18efb91f00bc053d326fa8549e9d484 /src/structs.h | |
parent | 0fb375aae608d7306b4baf9c1f906961f32e2abf (diff) |
patch 9.0.2142: [security]: stack-buffer-overflow in option callback functionsv9.0.2142
Problem: [security]: stack-buffer-overflow in option callback functions
Solution: pass size of errbuf down the call stack, use snprintf()
instead of sprintf()
We pass the error buffer down to the option callback functions, but in
some parts of the code, we simply use sprintf(buf) to write into the error
buffer, which can overflow.
So let's pass down the length of the error buffer and use sprintf(buf, size)
instead.
Reported by @henices, thanks!
Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/structs.h')
-rw-r--r-- | src/structs.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/structs.h b/src/structs.h index 4e081b860e..6d9dcbb2ab 100644 --- a/src/structs.h +++ b/src/structs.h @@ -4968,6 +4968,8 @@ typedef struct // is parameterized, then the "os_errbuf" buffer is used to store the error // message (when it is not NULL). char *os_errbuf; + // length of the error buffer + int os_errbuflen; } optset_T; /* |