From c9ad2b99dcf34ce9ba3685adba622dc2abd665ef Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Tue, 3 Nov 2020 09:19:58 -0600 Subject: Fix dir traversal maybe????? --- P2/lib/utils.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/P2/lib/utils.c b/P2/lib/utils.c index 4b2e35f..c7f752d 100644 --- a/P2/lib/utils.c +++ b/P2/lib/utils.c @@ -101,10 +101,9 @@ void shuffle(int nMappers, int nReducers) { DIR *dir = opendir(newpath); struct dirent* entry; while ((entry = readdir(dir)) != NULL) { - char newmsg[200]; if (!strcmp(".", entry->d_name) || !strcmp("..", entry->d_name)) continue; - + sprintf(message.msgText, "%s/%s", newpath, entry -> d_name); message.msgType = hashFunction(entry -> d_name, nReducers); printf("%ld\n", message.msgType); msgsnd(id, &message, chunkSize, 0); -- cgit v1.2.3