Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buffer-overflow FORTIFY_SOURCE=2 #114

Open
kirillrdy opened this issue Aug 2, 2023 · 0 comments · May be fixed by #115
Open

buffer-overflow FORTIFY_SOURCE=2 #114

kirillrdy opened this issue Aug 2, 2023 · 0 comments · May be fixed by #115

Comments

@kirillrdy
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant