src


Log

Author Commit Date CI Message
Guillem Jover b6ccd032 2024-02-28T04:44:02 build: Add a comment to libbsd-overlay.pc about -isystem usage Add the reasoning for why we use -isystem instead of -I, to avoid confusing unsuspecting readers of the file. Prompted-by: Alejandro Colomar <alx@kernel.org>
Guillem Jover 32d18dcf 2024-02-09T04:32:12 Add explicit time32 and time64 support Handle the three potential system scenarios: - system time_t is time64 - system time_t is time32 and supports time64 - system time_t is time32 and does not support time64 Add the explicit time32 and time64 functions when necessary and map them accordingly for each of these cases.
Guillem Jover ec7f5ee9 2024-02-12T01:04:37 Add vasprintf() and asprintf() functions missing on AIX These functions are used by code in the library, even though these functions started as GNU extensions, they are present in all BSDs, so we expose them as part of our interface on AIX.
Guillem Jover 5392f0c1 2024-02-12T02:55:08 build: Add support for Solaris
Guillem Jover be4aced4 2024-02-11T23:55:40 build: Make almost all exposed interfaces use the new ABI selection Explicitly select what to include as part of the target ABI, instead of letting autoconfiguration potentially break ABI if the system grows functionality provided by the library. Make almost all the library selectable per target. Do not install manual pages for interfaces not included in the library. Control inclusion of symbols in map file via pre-processor macros, and move the comments describing the ABI selection to configure.ac. For now the header files are included as is and filtered through pre-processor conditionals. Eventually they might get switched to be autogenerated at build time.
Guillem Jover 99739877 2024-02-14T04:59:44 build: Rename ABI selection variables from need_ to abi_ This should make the purpose of these variables more clear.
Guillem Jover a81d0b71 2024-02-11T23:55:40 build: Sort variables and their contents in automake files This should make it easier to add new entries, and find them afterwards.
Guillem Jover c8e5338a 2024-02-21T02:05:57 build: Rename LIBBSD_ABI to SOVERSION This matches the semantics of the variable, and makes it independent of the project, just as the package variables.
Guillem Jover f8cb9d8b 2024-02-20T03:57:37 build: Remove space before shell redirection This makes it more clear what the redirection applies to.
Guillem Jover 154624ab 2024-02-18T20:40:24 build: Add support for silent rules for the libbsd.map generation The new rule was introduced w/o silent rule support. Fixes: commit 19e06407eb365a2bedc9bdd29a83c1e1803e3f92
Guillem Jover 9fab225f 2024-02-17T05:25:01 Split errc family of functions from err ones On most systems the err family of functions is already present, but are missing the errc family of functions, which are also present on some other systems. Splitting them into separate files will make it easer to conditionally include one or the other.
Guillem Jover 461f10ac 2024-02-17T03:07:58 Sync strtoi()/strtou() implementations from NetBSD These contain the fixes to the error handling logic. In NetBSD the manual page for strtou.3 is generated from the strtoi.3 manual page applying some substitutions, the problem is that the cross-references are then lost. We will still keep them separate. Reported-by: Alejandro Colomar <alx@kernel.org>
Guillem Jover f0501609 2024-02-14T03:39:16 build: Swap symbol and alias arguments order in macros creating aliases The current order is rather confusing, pass the real symbol first and the alias we want to create next.
Guillem Jover 19e06407 2024-02-11T19:35:05 build: Generate the map file from the configured ABI Some linkers require the map file definitions to contain only symbols that are present on the linked object, either in the map file or in the sym file we generate from the map file. This is preparatory work to be able to conditionally include symbols in the man and sym files depending on the ABI definitions.
Guillem Jover 304a1f83 2024-01-08T23:37:43 doc: Use macOS to refer to the operating system This is the correct spelling, instead of capitalizing it.
Guillem Jover ecb44e16 2023-11-14T19:15:11 Do not add a pointer to the NULL constant Warned-by: cppcheck (nullPointerArithmetic)
Guillem Jover 459b7f7d 2023-11-14T19:09:25 Do not confuse code analyzers with out-of-bounds array access look alike The code is only getting the address, but we might be performing an addressing that is out-of-bounds. Avoid it and use the address form instead. Warned-by: cppcheck (objectIndex)
Guillem Jover 6777eb62 2023-07-27T13:57:51 pwcache: Do not declare uidtb and gidtb when not used When the system provides implementations for user_from_uid() or group_from_gid() we are not using these variables, so better not declare them. Fixes: commit 21d12b02112097f0c195dceb1892c95b7b957b36
Guillem Jover d4e0cdc9 2023-07-27T13:39:00 fgetln: Include <stdio.h> after <sys/*> The <sys/*> headers tend to define things that might be used by other headers, so while they should be self-contained, it is better to simply include them first.
Guillem Jover cf61ebb8 2023-04-22T20:47:20 build: Do not build the progname module if it is not needed This was made conditional, but the code part was accidentally left untouched due to having ported it locally to use __progname, which caused build failures on the stock repo. Fixes: commit 046621d7967e7a0f08ae988bcf7e4cd1b6cf204c
Guillem Jover 73b25a8f 2023-04-23T02:04:47 build: Sort entries alphabetically
Guillem Jover 5434ba16 2023-04-23T02:05:04 build: Conditionalize wcslcpy() and wcslcat() functions on macOS These functions are provided by the system libc.
Guillem Jover dc1bd1a2 2023-04-23T02:00:10 build: Conditionalize only id-from-name functions not the entire pwcache On macOS the name-from-id functions are present, but not the id-from-name ones, so we want to provide those instead of suppressing the entire file.
Guillem Jover 8f998d1d 2023-04-22T20:23:08 progname: Include <procinfo.h> if available We need this header on AIX. Missed transplanting the code from the AIX porting system. Fixes: commit 9fa06763a1afe0946a3a20e5bbdba72885cbade5
Guillem Jover 6385ccc9 2023-04-18T03:58:24 build: Conditionalize bsd_getopt() on macOS The system library provides a getopt() with BSD semantics.
Guillem Jover c1206817 2023-04-18T00:47:12 Move the version script comments before the symbols When generating the .sym export file from the .map file, we are not stripping these comments that are part of the same line as the symbol, which causes ld(1) implementations to error out. Moving them before the symbols avoids the need to strip them, as we are only keeping actual symbol lines.
Guillem Jover 9fa06763 2023-04-18T00:44:49 Port getprogname() to AIX Get the program name from the COMM field from the proc filesystem. We could use instead the information from the psinfo binary file under /proc, but that seems to have a shorter string limit.
Guillem Jover 92337b15 2023-04-17T23:59:03 Make getprogname() porting mandatory Although the function is documented as possibly returning NULL if it cannot find a known source of information, we should still at least attempt to port it to any supported system, and otherwise explicitly mark it as not implementable for such systems if that was to be the case.
Guillem Jover 8622767a 2023-04-11T00:24:13 build: Use an export symbols file if there is no version script support We generate the symbol list from the version script to avoid repeating ourselves and potentially getting the lists out-of-sync.
Guillem Jover 8f610364 2023-04-11T03:03:54 build: Add -no-undefined libtool flag We have no need for undefined symbols, so we can let the shared library build even on systems without support for undefined symbols.
Guillem Jover ae7942ba 2023-04-11T03:02:30 build: Do not override the default DEPENDENCIES for libbsd Extend it instead via EXTRA_*_DEPENDENCIES, to make sure that we preserve the builtin library dependencies generated from LIBADD.
Guillem Jover a5faf170 2023-04-01T12:46:49 Only use <stdio_ext.h> if present
Guillem Jover 06e8a1b2 2023-04-01T12:45:04 Define _NSIG if it is not defined by the system At least on macOS this macro is not defined.
Guillem Jover 44824aca 2023-04-01T12:41:42 Declare environ if the system does not do so The environ variable is supposed to be defined by the code using it, but on glibc-based systems it will get defined if we request it, by including <unistd.h> and defining _GNU_SOURCE.
Guillem Jover 1fb6c3f4 2023-04-10T23:10:40 Use lockf() when flock() is not available On Solaris flock() is not available, and we should use instead lockf() or fcntl().
Guillem Jover 21d12b02 2023-04-04T23:59:05 build: On macOS do not build functions provided by the system We have never built before on macOS, so we can exclude all the functions that are currently provided in the system. Closes: #1 Closes: !3
Guillem Jover bc65806c 2023-04-06T23:05:27 build: Select whether to include funopen() in the build system This makes sure we include it when expected, alongside the man pages, and the test cases, and do not accidentally break the ABI if the system starts providing such interface.
Guillem Jover e0976d7e 2023-04-02T22:33:25 build: Add a new libbsd_strong_alias() macro and switch users to it We had several cases of code needing a strong alias, so we switch those to use the new macro. This covers systems that support the alias attribute and others such as macOS where we need to use assembler directives to add the alias as the attribute is not supported.
Guillem Jover 49c7dd1c 2023-04-02T22:32:11 build: Only emit link warnings for ELF objects
Khem Raj ec88b7bb 2022-12-15T09:02:22 funopen: Replace off64_t with off_t in funopen_seek() AC_SYS_LARGEFILE in configure.ac is setting needed defines to make 64bit off_t on relevant platforms. Fixes build on musl: | src/funopen.c:68:28: error: unknown type name 'off64_t'; did you mean 'off_t'? | funopen_seek(void *cookie, off64_t *offset, int whence) | ^~~~~~~ | off_t Closes: !24 Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover e5089628 2022-11-23T23:31:54 build: Do not require funopen() to be ported This function cannot be easily and (more importantly) correctly ported without cooperation from the libc stdio layer. We already document that users should be prepared to have the function not available on some platforms and that they should ideally switch their code to other more portable and better interfaces. Instead of making the build fail, and requiring porters to add exceptions for something that most probably cannot be ported correctly anyway, simply print a warning and let it build. This will not be a regression because on those systems libbsd would have never been built before. Prompted-by: Jens Finkhaeuser <jens@finkhaeuser.de>
Guillem Jover 00b538ff 2022-11-23T23:28:34 build: Terminate lists in variables with «# EOL» This means we can add a trailing «\» to every element, so that they can be removed without requiring modification of other lines, and can be easily sorted. Replace the old usage of $(nil) which could possibly end up with junk added if such variable is ever defined, in the environment.
Guillem Jover 28298ac0 2022-10-05T01:35:08 doc: Switch references from pkg-config to pkgconf The former used to be the reference implementation, but it has been stagnant to the point of not showing much signs of life. Switch to the currently active and more complete implementation for references.
Guillem Jover be327c6e 2022-08-24T01:58:58 fgetwln: Add comment about lack of getwline(3) for recommendation Ideally we'd recommend getwline(3), but unfortunately even though it was part of the ISO/IEC TR 24731-2:2010 draft, it did not make it into C11 and is not widely implemented.
Guillem Jover a14612d9 2022-08-23T23:49:34 setmode: Dot not use saveset after free While we are only doing a pointer difference and not dereferencing it, it's easier and more correct to do the pointer difference before passing it to reallocarray(). Warned-by: gcc
Guillem Jover 1f6a48b2 2022-08-03T02:03:05 Sync arc4random(3) implementation from OpenBSD Closes: #12
Fabrice Fontaine 873639eb 2022-06-07T19:27:13 Fix ELF support for big endian SH Fix the following build failure with big endian SH (e.g. sh4aeb): ,--- In file included from nlist.c:44: nlist.c: In function '__elf_is_okay__': local-elf.h:223:25: error: 'ELFDATA2LMSB' undeclared (first use in this function); did you mean 'ELFDATA2LSB'? 223 | #define ELF_TARG_DATA ELFDATA2LMSB | ^~~~~~~~~~~~ `--- Fixes: http://autobuild.buildroot.org/results/2980fb79c208454195d77383f1ece9afbd7f981b Closes: !19 Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover 5f213075 2022-03-31T20:46:56 getentropy: Fix function cast for getauxval() Fix also the Hurd implementation, missed in the original fix. Extends: commit 72a82ee262795c9162e712885381a111fcf988bc Warned-by: gcc
WANG Xuerui 15200ec7 2021-09-11T12:54:28 Add LoongArch support to nlist() Closes: !13 Signed-off-by: WANG Xuerui <git@xen0n.name> Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guilherme Janczak e5ed5fdd 2021-12-31T08:25:08 Remove arc4random() OpenBSD support The arc4random() support for OpenBSD does not build. The intention was to include any portability code so that the library could be easily ported to such systems, but it makes little sense to build it on OpenBSD where most of the functionality will be already present, or the software would have been ported anyway. [guillem@hadrons.org: Reword commit message to add rationale. ] Closes: !15 Signed-off-by: Guillem Jover <guillem@hadrons.org>
Duncan Overbruck ba3c46b3 2022-01-25T20:32:30 fpurge: Make it work with non fd based FILEs Streams opened with for example open_memstream(3) will have no associated file descriptor, and fileno(3) will fail. Signed-off-by: Guillem Jover <guillem@hadrons.org>
Sam James f11ab672 2022-01-23T15:36:55 build: Respect $(OBJDUMP) We already search for it in `./configure` so let's respect the result of that search. This helps with cross-compilation and any other cases where one might want to choose a different toolchain. Closes: !16 Bug: https://bugs.gentoo.org/831863 Signed-off-by: Sam James <sam@gentoo.org> Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover 48107fc8 2021-11-28T23:19:16 build: Clarify link-time warnings Mention the involved function instead of stating an implicit "this function". Mention libbsd when proposing using an alternative libmd to make the context clear.
Guillem Jover e7cf8c57 2021-11-28T22:44:08 Switch md5 compatibility logic back to direct linking When using the recent dlsym() based wrapper, we are not requiring any symbol from libmd, as we resolve those dynamically at run-time. We were ending up linking against libmd because in another part of the code we require (depending on the architecture) the SHA512 functions for the getentropy() local implementation. But that function might be provided by the system libc on some systems, which means we end up not linking against libmd at all. To solve this we go back to the previous simpler solution of linking directly, which had the main drawback of then making programs fail to link when not specifying -lmd (on platforms that need it). And then switch the .so link point from a symlink to a linker script, so that we can inject the -lmd library as-needed. This is similar to what glibc is doing. Fixes: commit 31f034e3862debda8615a449b1c11c4d6920dcc7
Guillem Jover 25d35625 2021-11-28T22:40:58 build: Split libmd dependency due to MD5 functions from SHA requirements To be able to rework the md5 deprecation logic, we need to detangle when we depend on libmd due to requiring MD5 functions, which might be otherwise provided by libc, or when we require SHA functions for the internal getentropy() implementation.
Guillem Jover 500b3080 2021-11-28T22:34:59 build: Add new libbsd_symver_weak() macro We will use it for the reworked md5 deprecation logic.
Guillem Jover 8ad7570c 2021-11-27T21:07:00 getentropy: Add missing prototype for BSD variant Warned-by: gcc
Guillem Jover 43a82703 2021-11-27T20:26:05 nlist: Remove condition which is always true The nlist() function is limited to handle ELF binaries of the same class as size as the size_t of the architecture built. In addition the SIZE_T_MAX macro is BSD specific, and was falling back to the wrong constant on most 64-bit non-BSD systems. Warned-by: gcc
Guillem Jover 6a71b24b 2021-11-27T22:52:28 build: Append __ after __attribute and __typeof keywords Be consistent with other usages in the code base.
Victor Westerhuis 54f87456 2021-11-26T20:01:18 build: Enable .init_array support when building with LTO Because these symbols are not otherwise referenced, GCC would like to remove them. Signed-off-by: Guillem Jover <guillem@hadrons.org>
Alexander Miller c7a5d780 2021-09-30T03:39:57 build: Allow building with -flto on gcc-10 and newer Global asm statements (like .symver directives) do not work reliably in gcc with link time optimization. Use the symver attribute introduced with gcc-10 to set symbol versions instead, if available. [guillem@hadrons.org: - Simplify by using __has_attribute fallback from <sys/cdefs.h>. - Coding style changes. ] Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover 731b0a77 2021-08-17T02:59:59 build: Detect sed at configure time Check whether sed is available and use the implementation matching the requirements via the SED variable.
Guillem Jover 50b50a43 2021-03-02T05:18:04 vis: Add prototypes for strnvis() and strnunvis() variants Warned-by: gcc
Guillem Jover 04a8fb24 2021-03-02T00:48:02 Add missing prototypes to functions Warned-by: gcc
Guillem Jover 8f59221c 2021-02-19T06:51:18 nlist: Remove repeated shadowing variable declaration Warned-by: gcc
Guillem Jover 72a82ee2 2021-02-20T22:22:54 getentropy: Fix function cast for getauxval() Warned-by: gcc
Guillem Jover 25278891 2021-02-19T06:49:24 Mark local functions as static Warned-by: gcc
Guillem Jover e35d9141 2021-02-11T04:41:46 Add link-time warnings to MD5 wrapper functions Let's get the word out that these functions are deprecated and should be switched away from.
Guillem Jover 4feda870 2021-02-11T04:40:48 Require a semicolon for libbsd_link_warning() macro Remove the semicolon in the macro definition to force adding one on the call sites, to make the code look like an actual function.
Guillem Jover c0d86a64 2021-02-09T08:35:36 build: Add a Libs.private field to overlay pkg-config file We need to list all internal libraries there so that we can statically link. Fixes: commit 2374f409defb380d0c5c07f28b9c166ef8bdc742
Guillem Jover 31f034e3 2021-02-09T05:57:37 Switch libmd wrapper to use dlsym() Switch from the previous versioned symbol implementation which required users to also link against the message digest provider explicitly, or they would fail to find the symbols, to an implementation that loads the symbols from the linked library providing the functions using dlsym(), thus preserving backwards compatibility.
Guillem Jover 2374f409 2021-02-09T05:56:49 build: Add a Libs.private field to pkg-config file We need to list all internal libraries there so that we can statically link.
Guillem Jover a4e0db2b 2021-02-09T06:04:38 build: Use a single variable to track libraries to link against Using various variables means we have to keep these in sync in various places. Just use a single variable that we can use anywhere where this is needed.
Guillem Jover e832b768 2021-02-08T03:45:06 closefrom: Use close_range() on Linux when available Closes: !11 Based-on-patch-by: cptpcrd <cptpcrd.git@gmail.com> Signed-off-by: Guillem Jover <guillem@hadrons.org>
cptpcrd c4fca5bb 2021-02-07T14:22:21 closefrom: Handle lowfd < 0 properly More important if close_range() is going to be used, since casting negative values to 'unsigned int' might hide the errors. [guillem@hadrons.org: Minor coding style fix. ] Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover a1f79978 2021-02-08T02:52:50 closefrom: Import some changes from sudo Take most of the changes done in sudo, but preserve the existing local changes and refactoring. In addition, refactor pstat implementation into closefrom_pstat(), so that the code is easier to read, and requires no conditional declarations.
Guillem Jover d54ceb37 2021-02-07T00:09:45 Update copyright claims
Guillem Jover 847e682f 2021-02-07T00:09:30 Use libmd hashing function implementations instead of embedding our own This splits the implementation responsibilities, and reduces embedded code copies, which was one of the driving points with this project to start with, so it's nice to give a good example.
Aaron Dierking 68f980c9 2018-07-05T14:47:47 Provide a default progname on Windows [guillem@hadrons.org: - Remove .exe extension from default program name. - Call reallocarray() once by switching to a «do {} while» loop. - Minor coding style fixes. ] Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover 37a9b56c 2021-02-06T23:43:12 Import pwcache module from OpenBSD
Faidon Liambotis 01f0d1ea 2020-12-31T12:46:03 Add recallocarray() and freezero() from OpenBSD Add recallocarray(), introduced in OpenBSD 6.1, and freezero(), introduced in OpenBSD 6.2. The former is imported as-is from OpenBSD, while the latter is the non-malloc-internal branch of the same code (and also the OpenSSH portable variant). Both of these originated in OpenBSD, but have also been implemented by IllumOS, cf. https://www.illumos.org/issues/8546 Documentation for these functions is in malloc(3) upstream, the relevant parts of which were previously imported in reallocarray(3bsd). Update reallocarray(3bsd) with the changes that were introduced since, and add the relevant bits for recallocarray() and freezero(), plus aliases. [guillem@hadrons.org: Update copyright in COPYING. ] Closes: !10 Signed-off-by: Guillem Jover <guillem@hadrons.org>
Seth R Johnson 9c85d828 2019-11-14T07:26:41 Fix ELF detection on Intel compilers The Intel compiler does not define __amd64__ on x86_64 platforms; instead, like other compilers, it defines __x86_64__ . Closes: !8 Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover cfeafeab 2020-08-16T21:58:04 funopen: Fix memory leak in funopen_close() when closefn is NULL We need to free the cookiewrap even when the closefn method is NULL. Warned-by: gcc ASAN
Guillem Jover 3d6b6ead 2019-11-16T00:04:18 build: Detect support for --version-script in ld
Guillem Jover eb445425 2019-08-12T23:52:10 Do not define SIZE_T_MAX if already defined
Guillem Jover 3548c5f6 2019-08-26T05:39:17 Add missing strnvisx() to the symbols script Fixes: commit 2d7de186e9cb19a756c0630ee85cb3f2d29b3484.
Guillem Jover 5745ca03 2019-08-06T15:49:41 err: Add err(), warn(), errx() and warnx() familiy of functions Some systems such as Windows or musl-libc based ones do not have these BSD extensions. In addition libbsd itself is making use of the warnx() functions, so we better provide these interfaces in case they are missing.
Guillem Jover 9628798d 2019-08-06T15:37:43 err: Rewrite warnc() and errc() family functions to be standalone Do not depend on the system vwarn() and verr() functions to implement the *c() variants, as the system might actually lack any of the <err.h> BSD extensions.
Michael Shigorin 72c68868 2019-08-07T00:02:09 Add e2k support for nlist() This is a Russian 64-bit LE VLIW architecture named Elbrus (formerly Elbrus 2000). [guillem@hadrons.org: - Place the entry in alphabetical order. ] Signed-off-by: Guillem Jover <guillem@hadrons.org>
Frank Schaefer a4323f2b 2019-05-28T16:04:54 Add AArch64 ILP32 support to nlist() Closes: !7 Signed-off-by: Guillem Jover <guillem@hadrons.org>
Rosen Penev 4997efa5 2019-05-17T01:44:56 Add ARC support to nlist() Closes: !6 Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover 96202c6c 2019-08-07T00:00:15 Add a comment to note the ELF entries are sorted alphabetically This should help people wanting to add new entries.
Guillem Jover 9d917aad 2019-08-07T22:58:30 nlist: Fix out-of-bounds read on strtab When doing a string comparison for a symbol name from the string table, we should make sure we do a bounded comparison, otherwise a non-NUL terminated string might make the code read out-of-bounds. Warned-by: coverity
Guillem Jover 18662cad 2019-06-15T14:33:32 nlist: Fix unbounded malloc() calls There are a couple of malloc() calls with unbounded size arguments, coming from the parsed file. We need to make sure the size is not larger than the file being parsed, otherwise we might end up with out of memory conditions. Reported-by: Daniel Hodson <daniel@elttam.com.au> Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover ce53f7c2 2019-06-15T14:33:32 nlist: Fix pread() return value check We should check for partial reads, and not continue in those cases, as we are not retrying them, otherwise we might end up operating on uninitialized data. Reported-by: Daniel Hodson <daniel@elttam.com.au> Based-on-patch-by: Daniel Hodson <daniel@elttam.com.au> Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover 24d1f4dd 2019-06-15T14:33:32 nlist: Check whether sh_link is within bounds The sh_link members should be >= e_shnum, otherwise we might do out of bounds read accesses on the shdr array. Reported-by: Daniel Hodson <daniel@elttam.com.au> Based-on-patch-by: Daniel Hodson <daniel@elttam.com.au> Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover e9529d9b 2019-06-15T14:33:32 nlist: Check that e_shnum and e_shentsize are within bounds The e_shnum must not be 0, otherwise we will do a zero sized allocation and further processing of the executable will lead to out of bounds read/write accesses. The e_shentsize must be equal to sizeof(Elf_Shdr), otherwise we will perform out of bounds read accesses on the shdr array. Reported-by: Daniel Hodson <daniel@elttam.com.au> Based-on-patch-by: Daniel Hodson <daniel@elttam.com.au> Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover 3aaedb12 2019-06-15T14:33:32 nlist: Check whether the nl argument is not NULL This prevents programming errors. Reported-by: Daniel Hodson <daniel@elttam.com.au> Based-on-patch-by: Daniel Hodson <daniel@elttam.com.au> Signed-off-by: Guillem Jover <guillem@hadrons.org>
Aaron Dierking f99b8ea5 2018-06-14T11:38:33 build: Disable CRT warnings on Windows These warnings are not helpful for libbsd. [guillem@hadrons.org: - Rename WINDOWS conditional to OS_WINDOWS. - Add a nil terminator to the AM_CPPFLAGS. ] Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover 2e071c3c 2019-08-06T19:14:29 build: Support platforms without symbol versioning The .symver directive is ELF-specific. On non-ELF platforms, work around this with __attribute__((__alias__)) for the default symbol, and ignore the variant versioned symbols. Based-on-patch-by: Aaron Dierking <aarond@fb.com> Signed-off-by: Guillem Jover <guillem@hadrons.org>