Ticket #13869: 0003-libs-bsd-add-explicit_bzero-3.patch

File 0003-libs-bsd-add-explicit_bzero-3.patch, 1.8 KB (added by leorize, 7 years ago)
  • headers/compatibility/bsd/string.h

    From 60f45665dbe72537ce6f48b53929b9efcad273bb Mon Sep 17 00:00:00 2001
    From: Leorize <alaviss@users.noreply.github.com>
    Date: Thu, 14 Dec 2017 07:25:45 +0700
    Subject: [PATCH 3/5] libs/bsd: add explicit_bzero(3)
    
    ---
     headers/compatibility/bsd/string.h |  1 +
     src/libs/bsd/Jamfile               |  1 +
     src/libs/bsd/explicit_bzero.c      | 22 ++++++++++++++++++++++
     3 files changed, 24 insertions(+)
     create mode 100644 src/libs/bsd/explicit_bzero.c
    
    diff --git a/headers/compatibility/bsd/string.h b/headers/compatibility/bsd/string.h
    index 7d194971..c19ea27f 100644
    a b extern "C" {  
    1717#endif
    1818
    1919char* strsep(char** string, const char* delimiters);
     20void explicit_bzero(void *buf, size_t len);
    2021
    2122#ifdef __cplusplus
    2223}
  • src/libs/bsd/Jamfile

    diff --git a/src/libs/bsd/Jamfile b/src/libs/bsd/Jamfile
    index 2b77ca4c..42f27467 100644
    a b for architectureObject in [ MultiArchSubDirSetup ] {  
    1313        SharedLibrary [ MultiArchDefaultGristFiles libbsd.so ] :
    1414            daemon.c
    1515            err.c
     16            explicit_bzero.c
    1617            fgetln.c
    1718            getpass.c
    1819            issetugid.c
  • new file src/libs/bsd/explicit_bzero.c

    diff --git a/src/libs/bsd/explicit_bzero.c b/src/libs/bsd/explicit_bzero.c
    new file mode 100644
    index 00000000..359e4d41
    - +  
     1/*  $OpenBSD: explicit_bzero.c,v 1.3 2014/06/21 02:34:26 matthew Exp $ */
     2/*
     3 * Public domain.
     4 * Written by Matthew Dempsky.
     5 */
     6
     7#include <string.h>
     8
     9__attribute__((weak)) void
     10__explicit_bzero_hook(void *buf, size_t len);
     11
     12__attribute__((weak)) void
     13__explicit_bzero_hook(void *buf, size_t len)
     14{
     15}
     16
     17void
     18explicit_bzero(void *buf, size_t len)
     19{
     20    memset(buf, 0, len);
     21    __explicit_bzero_hook(buf, len);
     22}