steps to reproduce
crash.c
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char **argv) {
char foo[4];
readlink("/etc/localtime", foo, atoi(argv[1]));
return 0;
}
cc -O1 -D_FORTIFY_SOURCE=2 -o crash crash.c
fakechroot ./crash 4
*** buffer overflow detected ***: terminated
/home/kirillvr/.nix-profile/bin/fakechroot: line 263: 25494 Aborted (core dumped) LD_LIBRARY_PATH="$fakechroot_paths" LD_PRELOAD="$fakechroot_lib" "$fakechroot_cmd" "$@"
additional info
cc --version
gcc (GCC) 12.3.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
fakechroot --version
fakechroot version 2.20.1
steps to reproduce
crash.c
cc -O1 -D_FORTIFY_SOURCE=2 -o crash crash.cadditional info