xref: /third_party/musl/libc-test/src/regression/memmem-oob.c (revision 570af302)
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/musl/libc-test/src/regression/
1570af302Sopenharmony_ci// commit 6fbdeff0e51f6afc38fbb1476a4db81322779da4 2014-04-09
2570af302Sopenharmony_ci// memmem should not access oob data
3570af302Sopenharmony_ci#ifndef _GNU_SOURCE
4570af302Sopenharmony_ci#define _GNU_SOURCE
5570af302Sopenharmony_ci#endif
6570af302Sopenharmony_ci#include <string.h>
7570af302Sopenharmony_ci#include "test.h"
8570af302Sopenharmony_ci
9570af302Sopenharmony_ciint main(void)
10570af302Sopenharmony_ci{
11570af302Sopenharmony_ci	char *p = memmem("abcde", 4, "cde", 3);
12570af302Sopenharmony_ci	if (p)
13570af302Sopenharmony_ci		t_error("memmem(abcde,4,cde,3) returned %s, want NULL\n", p);
14570af302Sopenharmony_ci	return t_status;
15570af302Sopenharmony_ci}
16

Indexes created Thu Nov 07 10:32:03 CST 2024