summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/regress/lib/libc/malloc/malloc_errs/malloc_errs.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/regress/lib/libc/malloc/malloc_errs/malloc_errs.c b/src/regress/lib/libc/malloc/malloc_errs/malloc_errs.c
index 6040590a65..c711980861 100644
--- a/src/regress/lib/libc/malloc/malloc_errs/malloc_errs.c
+++ b/src/regress/lib/libc/malloc/malloc_errs/malloc_errs.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: malloc_errs.c,v 1.3 2023/06/04 06:58:33 otto Exp $ */ 1/* $OpenBSD: malloc_errs.c,v 1.4 2023/10/22 12:20:07 otto Exp $ */
2/* 2/*
3 * Copyright (c) 2023 Otto Moerbeek <otto@drijf.net> 3 * Copyright (c) 2023 Otto Moerbeek <otto@drijf.net>
4 * 4 *
@@ -226,6 +226,17 @@ t20(void)
226 free(p); 226 free(p);
227} 227}
228 228
229/* out-of-bound write preceding chunk */
230void
231t22(void)
232{
233 int i, j;
234 unsigned char *p = malloc(32);
235 p[32] = 0;
236 for (i = 0; i < 10000; i++)
237 p = malloc(32);
238}
239
229struct test { 240struct test {
230 void (*test)(void); 241 void (*test)(void);
231 const char *flags; 242 const char *flags;
@@ -253,6 +264,9 @@ struct test tests[] = {
253 { t18, "" }, 264 { t18, "" },
254 { t19, "" }, 265 { t19, "" },
255 { t20, "C" }, 266 { t20, "C" },
267 { t8, "FJD" }, /* t21 re-uses code from t8 */
268 { t22, "J" },
269 { t22, "JD" }, /* t23 re-uses code from t22 */
256}; 270};
257 271
258int main(int argc, char *argv[]) 272int main(int argc, char *argv[])