summaryrefslogtreecommitdiffstats
path: root/src/core/string.c
Commit message (Collapse)AuthorAgeFilesLines
* [libc] Fix strcmp()/strncmp() to return proper valuesAaron Young2019-01-151-3/+3
| | | | | | | | | | | | | | | Fix strcmp() and strncmp() to return proper standard positive/negative values for unequal strings. Current implementation is backwards (i.e. the functions are returning negative when should be positive and vice-versa). Currently all consumers of these functions only check the return value for ==0 or !=0 and so we can safely change the implementation without breaking things. Signed-off-by: Aaron Young <Aaron.Young@oracle.com> Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Avoid implicit assumptions about potentially-optimised memcpy()Michael Brown2016-05-091-1/+1
| | | | | | | | Do not assume that an architecture-specific optimised memcpy() will have the same properties as generic_memcpy() in terms of handling overlapping regions. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Relicense files under GPL2_OR_LATER_OR_UBDLMichael Brown2015-03-021-1/+5
| | | | | | | Relicense files for which I am the sole author (as identified by util/relicense.pl). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Rewrite strtoul()Michael Brown2015-02-191-0/+129
| | | | | | | | | | The implementation of strtoul() has a partially unknown provenance. Rewrite this code to avoid potential licensing uncertainty. Since we now use -ffunction-sections, there is no need to place strtoull() in a separate file from strtoul(). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Rewrite string functionsMichael Brown2015-02-171-258/+273
| | | | | | | | | | | | Some of the C library string functions have an unknown provenance. Reimplement all such functions to avoid potential licensing uncertainty. Remove the inline-assembler versions of strlen(), memswap(), and strncmp(); these save a minimal amount of space (around 40 bytes in total) and are not performance-critical. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Prevent strndup() from reading beyond the end of the stringMichael Brown2014-05-181-3/+1Star
| | | | | | | | | | | | strndup() may be called on a string which is not NUL-terminated. Use strnlen() instead of strlen() to ensure that we do not read beyond the end of such a string. Add self-tests for strndup(), including a test case with an unterminated string. Originally-fixed-by: Marin Hannache <git@mareo.fr> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Add a selection of FILE_LICENCE declarationsMichael Brown2009-05-181-0/+2
| | | | | Add FILE_LICENCE declarations to almost all files that make up the various standard builds of gPXE.
* move strndup back to string.c - used by strdupHolger Lubitz2007-08-021-0/+15
|
* stripped down version of string.c containing only the used functionsHolger Lubitz2007-08-021-251/+0Star
|
* make bcopy use memmoveHolger Lubitz2007-07-291-6/+1Star
|
* Dead code removal.Michael Brown2007-07-141-0/+8
| | | | Kill off use of etherboot.h outside drivers/net.
* Add strcspn() and strndup()Michael Brown2007-07-081-4/+41
|
* Move tolower() etc to ctype.h as per ISO CMichael Brown2007-01-261-0/+1
|
* Added strdup()Michael Brown2006-12-081-2/+10
|
* Initial revisionMichael Brown2005-03-081-0/+540