[Sanitizers] intercept fparseln on freebsd

Reviewed By: vitalybuka, emaste

Differential Revision: https://reviews.llvm.org/D109753
This commit is contained in:
David Carlier 2021-09-14 19:13:45 +01:00
parent 66c6bbe7ff
commit fa7c01e578
2 changed files with 27 additions and 1 deletions

View File

@ -540,7 +540,7 @@
#define SANITIZER_INTERCEPT_MODCTL SI_NETBSD
#define SANITIZER_INTERCEPT_CAPSICUM SI_FREEBSD
#define SANITIZER_INTERCEPT_STRTONUM (SI_NETBSD || SI_FREEBSD)
#define SANITIZER_INTERCEPT_FPARSELN SI_NETBSD
#define SANITIZER_INTERCEPT_FPARSELN (SI_NETBSD || SI_FREEBSD)
#define SANITIZER_INTERCEPT_STATVFS1 SI_NETBSD
#define SANITIZER_INTERCEPT_STRTOI SI_NETBSD
#define SANITIZER_INTERCEPT_CAPSICUM SI_FREEBSD

View File

@ -0,0 +1,26 @@
// RUN: %clangxx -O0 -g %s -o %t -lutil && %run %t 2>&1 | FileCheck %s
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <libutil.h>
int main(void) {
printf("fparseln\n");
FILE *fp = fopen("/etc/fstab", "r");
assert(fp);
int flags = FPARSELN_UNESCALL;
const char *delim = "\\\\#";
size_t lineno = 0, len;
char *line;
while ((line = fparseln(fp, &len, &lineno, delim, flags))) {
printf("lineno: %zu, length: %zu, line: %s\n", lineno, len, line);
free(line);
}
// CHECK: fparseln
return 0;
}