diff options
Diffstat (limited to 'neozip/test/test_cve-2003-0107.cc')
| -rw-r--r-- | neozip/test/test_cve-2003-0107.cc | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/neozip/test/test_cve-2003-0107.cc b/neozip/test/test_cve-2003-0107.cc new file mode 100644 index 0000000000..9d9e5b00df --- /dev/null +++ b/neozip/test/test_cve-2003-0107.cc @@ -0,0 +1,28 @@ +// https://www.securityfocus.com/archive/1/312869 --- originally by Richard Kettlewell +#include <stdlib.h> +#include <errno.h> +#include <stdio.h> + +#include "zbuild.h" +#ifdef ZLIB_COMPAT +# include "zlib.h" +#else +# include "zlib-ng.h" +#endif + +#include <gtest/gtest.h> + +#if !defined(_WIN32) && defined(ZLIB_COMPAT) +TEST(gzip, cve_2003_0107) { + gzFile f; + int ret; + + f = gzopen("/dev/null", "w"); + EXPECT_TRUE(f != NULL); + + ret = gzprintf(f, "%10240s", ""); + printf("gzprintf -> %d\n", ret); + ret = gzclose(f); + printf("gzclose -> %d [%d]\n", ret, errno); +} +#endif |
