win32_wglob(): Fix too-short malloc of filename buffers
authorEric Biggers <ebiggers3@gmail.com>
Sun, 5 May 2013 05:19:11 +0000 (00:19 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Sun, 5 May 2013 05:19:11 +0000 (00:19 -0500)
programs/imagex-win32.c

index 0fe04399e8fc4b603faad77bb2ca563ede25a733..ca34781680a88cde082fad4a17e83a5768817332 100644 (file)
@@ -81,7 +81,7 @@ win32_wglob(const wchar_t *pattern, int flags,
                size_t filename_len = wcslen(dat.cFileName);
                size_t len_needed = prefix_len + filename_len;
 
-               path = malloc(len_needed + sizeof(wchar_t));
+               path = malloc((len_needed + 1) * sizeof(wchar_t));
                if (!path)
                        goto oom;