From be83d7718711510dece52fba926bf0b830de3af5 Mon Sep 17 00:00:00 2001 From: Eric Chu Date: Fri, 15 Apr 2016 12:54:30 -0400 Subject: [PATCH] Fix buffer overflow due to null character --- pathchanger/pathchanger.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pathchanger/pathchanger.c b/pathchanger/pathchanger.c index 80aa90b..264f267 100644 --- a/pathchanger/pathchanger.c +++ b/pathchanger/pathchanger.c @@ -76,14 +76,14 @@ int main(int argc, char **argv) error(payload, "Pattern not found"); } - u8 input[37] = {0}; - u8 payloadname[2 * sizeof(input)] = {0}; + u8 input[38] = {0}; + u8 payloadname[2 * (sizeof(input) - 1)] = {0}; printf("Enter the payload's path (37 characters max): "); scanf("%37s", input); unsigned int i; - for (i = 0; i < sizeof(input); i++) + for (i = 0; i < sizeof(input) - 1; i++) payloadname[2 * i] = input[i]; memcpy(found + 12, payloadname, sizeof(payloadname));