Skip to content

buffer-overflow FORTIFY_SOURCE=2 #114

@kirillrdy

Description

@kirillrdy

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions