From ecba9ee5d74f2df4ea38eb2542e79ec6d4859d7e Mon Sep 17 00:00:00 2001 From: EnderIce2 Date: Tue, 19 Mar 2024 17:05:26 +0200 Subject: [PATCH] Fix buffer overflow --- apps/base/utest/userspace_test.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/base/utest/userspace_test.c b/apps/base/utest/userspace_test.c index a48ffdb2..22035581 100644 --- a/apps/base/utest/userspace_test.c +++ b/apps/base/utest/userspace_test.c @@ -493,13 +493,13 @@ char *create_file() if (p == NULL) { - path = malloc(20); + path = malloc(24); sprintf(path, "/tmp/watched_file.txt"); fp = fopen(path, "w"); } else { - path = malloc(strlen(p->pw_dir) + 20); + path = malloc(strlen(p->pw_dir) + 24); sprintf(path, "%s/watched_file.txt", p->pw_dir); fp = fopen(path, "w"); } @@ -521,12 +521,12 @@ char *create_directory() if (p == NULL) { - path = malloc(20); + path = malloc(24); sprintf(path, "/tmp/watched_directory"); } else { - path = malloc(strlen(p->pw_dir) + 20); + path = malloc(strlen(p->pw_dir) + 24); sprintf(path, "%s/watched_directory", p->pw_dir); }