view gcc/testsuite/gcc.dg/analyzer/CVE-2005-1689-dedupe-issue.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
line wrap: on
line source

#include <stdlib.h>

typedef struct _krb5_data {
  char *data;
} krb5_data;

/* Ensure that we de-duplicate the various paths to reach here,
   and only emit one diagnostic.  */

void
recvauth_common(krb5_data inbuf)
{
  free(inbuf.data);
  free(inbuf.data); /* { dg-warning "double-'free'" "warning" } */
  /* { dg-message "2 duplicates" "duplicates notification" { target *-*-* } .-1 } */
}

void krb5_recvauth(krb5_data inbuf)
{
  recvauth_common(inbuf);
}

void krb5_recvauth_version(krb5_data inbuf)
{
  recvauth_common(inbuf);
}