From a86ee1251a54ae2aff5389678631ea2429493294 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Wed, 27 Apr 2005 18:59:53 +0000 Subject: [PATCH] check that string is properly terminated git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14994 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/roken/parse_time-test.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/roken/parse_time-test.c b/lib/roken/parse_time-test.c index b984ae679..f7b980d69 100644 --- a/lib/roken/parse_time-test.c +++ b/lib/roken/parse_time-test.c @@ -81,6 +81,8 @@ main(int argc, char **argv) (unsigned long)buf_sz); if (buf_sz > 0 && memcmp(buf, tests[i].str, buf_sz - 1) != 0) errx(1, "test %i wrong result %s vs %s", i, buf, tests[i].str); + if (buf_sz > 0 && buf[buf_sz - 1] != '\0') + errx(1, "test %i not zero terminated", i); rk_test_mem_free("overrun"); buf = rk_test_mem_alloc(RK_TM_UNDERRUN, "underrun", @@ -93,6 +95,8 @@ main(int argc, char **argv) (unsigned long)buf_sz); if (buf_sz > 0 && strncmp(buf, tests[i].str, buf_sz - 1) != 0) errx(1, "test %i wrong result %s vs %s", i, buf, tests[i].str); + if (buf_sz > 0 && buf[buf_sz - 1] != '\0') + errx(1, "test %i not zero terminated", i); rk_test_mem_free("underrun"); } buf = rk_test_mem_alloc(RK_TM_OVERRUN, "overrun",