VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/VBoxClient/chk_stubs.c@ 78403

Last change on this file since 78403 was 76553, checked in by vboxsync, 6 years ago

scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.7 KB
Line 
1/* $Id: chk_stubs.c 76553 2019-01-01 01:45:53Z vboxsync $ */
2/** @file
3 * glibc stubs for the VirtualBox Guest Addition X11 Client.
4 */
5
6/*
7 * Copyright (C) 2018-2019 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18/* If we want the binary to be usable with glibc 2.3, we have to prevent
19 VBoxClient from containing later symbols. This includes resolution of
20 symbols from supc++ and gcc_eh. */
21
22#include <stdio.h>
23#include <stdarg.h>
24#include <string.h>
25#include <unistd.h>
26
27extern int __sprintf_chk(char *psz, int fFlags, size_t cb, const char *pszFormat, ...);
28int __sprintf_chk(char *psz, int fFlags, size_t cb, const char *pszFormat, ...)
29{
30 int rc;
31 va_list va;
32
33 (void)fFlags;
34 va_start(va, pszFormat);
35 rc = vsnprintf(psz, cb, pszFormat, va);
36 va_end(va);
37 return rc;
38}
39
40extern void __stack_chk_fail(void);
41void __stack_chk_fail(void)
42{
43 fprintf(stderr, "Stack check failed!\n");
44 _exit(1);
45}
46
47#ifdef __x86_64
48/* Furthermore, wrap references to memcpy to force them to go to the right
49 * version. We are forced to do it this way because the shared libraries
50 * supc++ and gcc_eh contain references which we cannot change. */
51
52extern void *__wrap_memcpy(void *dest, const void *src, size_t n);
53
54asm (".symver memcpy, memcpy@GLIBC_2.2.5");
55void *__wrap_memcpy(void *dest, const void *src, size_t n)
56{
57 return memcpy(dest, src, n);
58}
59#endif
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette