VirtualBox

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

Last change on this file was 106061, checked in by vboxsync, 8 weeks ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.0 KB
Line 
1/* $Id: chk_stubs.c 106061 2024-09-16 14:03:52Z vboxsync $ */
2/** @file
3 * glibc stubs for the VirtualBox Guest Addition X11 Client.
4 */
5
6/*
7 * Copyright (C) 2018-2024 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28/* If we want the binary to be usable with glibc 2.3, we have to prevent
29 VBoxClient from containing later symbols. This includes resolution of
30 symbols from supc++ and gcc_eh. */
31
32#include <stdio.h>
33#include <stdarg.h>
34#include <string.h>
35#include <unistd.h>
36
37extern int __sprintf_chk(char *psz, int fFlags, size_t cb, const char *pszFormat, ...);
38int __sprintf_chk(char *psz, int fFlags, size_t cb, const char *pszFormat, ...)
39{
40 int rc;
41 va_list va;
42
43 (void)fFlags;
44 va_start(va, pszFormat);
45 rc = vsnprintf(psz, cb, pszFormat, va);
46 va_end(va);
47 return rc;
48}
49
50extern void __stack_chk_fail(void);
51void __stack_chk_fail(void)
52{
53 fprintf(stderr, "Stack check failed!\n");
54 _exit(1);
55}
56
57#ifdef __x86_64
58/* Furthermore, wrap references to memcpy to force them to go to the right
59 * version. We are forced to do it this way because the shared libraries
60 * supc++ and gcc_eh contain references which we cannot change. */
61
62extern void *__wrap_memcpy(void *dest, const void *src, size_t n);
63
64asm (".symver memcpy, memcpy@GLIBC_2.2.5");
65void *__wrap_memcpy(void *dest, const void *src, size_t n)
66{
67 return memcpy(dest, src, n);
68}
69#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