tFix strncat() usage to prevent overflow - safe - password protected secret keeper
(HTM) git clone git://git.z3bra.org/safe.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit b8dbdc4755041d3c11180863f2d56f037fb81952
(DIR) parent 2afd68e3972e0f04ef4b3c8f4fcc93726dca03d8
(HTM) Author: Willy Goiffon <dev@z3bra.org>
Date: Mon, 27 May 2019 11:20:30 +0200
Fix strncat() usage to prevent overflow
Diffstat:
M safe.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
(DIR) diff --git a/safe.c b/safe.c
t@@ -207,7 +207,7 @@ creatsock(char *sockpath)
err(1, "mkdtemp: %s", path);
strncat(path, "/", 1);
- strncat(path, SOCKET, sizeof(path));
+ strncat(path, SOCKET, sizeof(path) - strlen(SOCKET) - 1);
}
sfd = socket(AF_UNIX, SOCK_STREAM, 0);