summaryrefslogtreecommitdiff
path: root/src/lib/string
AgeCommit message (Collapse)Author
2021-11-05Prefer use of __MINGW_PRINTF/SCANF_FORMAT if available.Nick Mathewson
Mingw headers sometimes like to define alternative scanf/printf format attributes depending on whether they're using clang, UCRT, MINGW_ANSI_STDIO, or the microsoft version of printf/scanf. This change attempts to use the right one on the given platform. This is an attempt to fix part of #40355.
2021-03-12Update copyrights to 2021, using "make update-copyright"Nick Mathewson
2020-08-14Revise trac.torproject.org urls to refer to gitlab replacements.Nick Mathewson
Closes #40101.
2020-07-15Add support for patterns on %include #25140Daniel Pinto
Also adds generic tor_glob function to expand globs.
2020-05-19Doxygen: fix unbalanced groups.Nick Mathewson
Closes ticket 34255.
2020-01-08It's 2020. Update the copyright dates with "make update-copyright"Nick Mathewson
2020-01-07string: Check UTF-8 string pointer and lengthteor
If they are inconsistent, output a raw bug log. Part of 32845.
2019-11-15Doxygen: rename all .dox files to end with .mdNick Mathewson
Using a standard ending here will let other tools that expect markdown understand our output here. This commit was automatically generated with: for fn in $(find src -name '*.dox'); do \ git mv "$fn" "${fn%.dox}.md"; \ done
2019-11-15Doxygen: remove /** and **/ from all .dox filesNick Mathewson
This is an automatically generated commit, made with: find src -name '*.dox' | \ xargs perl -i -ne 'print unless (m#^\s*/?\*\*/?\s*$#);'
2019-11-12Move 01g-strings.md into doxygen.Nick Mathewson
2019-11-04Doxygen: Avoid ambiguity in @dir directivesNick Mathewson
This commit was automatically generated with: find src -name '*.dox' |xargs perl -i -pe 's{\@dir ([^/])}{\@dir /$1};'
2019-11-04doxygen: Take "lib" descriptions from doc/HACKING/design.Nick Mathewson
This commit takes descriptions for src/lib and moves them into our doxygen hierarchy. I've covered everything from lib/cc through lib/sandbox here.
2019-11-04Add stub directory-level documentation for most source directoriesNick Mathewson
This includes app, core, feature, lib, and tools, but excludes ext, test, and trunnel. This was generated by the following shell script: cd src for dname in $(find lib core feature app tools -type d |grep -v \\.deps$); do keyword="$(echo "$dname" |sed -e "s/\//_/" )" target="${dname}/${keyword}.dox" echo "$target" cat <<EOF >"$target" /** @dir ${dname} @brief ${dname} **/ EOF git add "$target" done
2019-10-22Use STMT_BEGIN/END in parse_int.c so coccinelle can handle it.Nick Mathewson
2019-08-29string: macOS --enable-fragile-hardening uses safe string functionsteor
Comment-only change.
2019-07-29Merge branch 'tor-github/pr/1179' into maint-0.4.1David Goulet
2019-07-19Prevent UB on signed overflow.Tobias Stoeckmann
Overflowing a signed integer in C is an undefined behaviour. It is possible to trigger this undefined behaviour in tor_asprintf on Windows or systems lacking vasprintf. On these systems, eiter _vscprintf or vsnprintf is called to retrieve the required amount of bytes to hold the string. These functions can return INT_MAX. The easiest way to recreate this is the use of a specially crafted configuration file, e.g. containing the line: FirewallPorts AAAAA<in total 2147483610 As> This line triggers the needed tor_asprintf call which eventually leads to an INT_MAX return value from _vscprintf or vsnprintf. The needed byte for \0 is added to the result, triggering the overflow and therefore the undefined behaviour. Casting the value to size_t before addition fixes the behaviour. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2019-06-05Run "make autostyle."Nick Mathewson
2019-05-30Merge branch 'tor-github/pr/1054'David Goulet
2019-05-29Merge branch 'ticket30561_029' into ticket30561_035Nick Mathewson
2019-05-07Merge branch 'tor-github/pr/994'David Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-05-02Add comments to include.am files to note where new sources goNick Mathewson
This mechanism isn't perfect, and sometimes it will guess wrong, but it will help our automation.
2019-04-30Replace all remaining tor_mem_is_zero() with fast_mem_is_zero()Nick Mathewson
2019-04-30Rename tor_mem_is_zero to fast_mem_is_zero()Nick Mathewson
For memeq and friends, "tor_" indicates constant-time and "fast_" indicates optimized. I'm fine with leaving the constant-time "safe_mem_is_zero" with its current name, but the "tor_" prefix on the current optimized version is misleading. Also, make the tor_digest*_is_zero() uniformly constant-time, and add a fast_digest*_is_zero() version to use as needed. A later commit in this branch will fix all the users of tor_mem_is_zero(). Closes ticket 30309.
2019-01-16Bump copyright date to 2019Nick Mathewson
2019-01-16Bump copyright date to 2019.Nick Mathewson
2018-12-17Remove strcmp_len(): it is now unusedNick Mathewson
(See 28856.)
2018-11-14Normalize .may_include to always have paths, and paths to includeNick Mathewson
2018-10-23string: add BOM helpercypherpunks
2018-09-03string: add string_is_utf8() helpercypherpunks
Ticket #27373.
2018-07-17Increase line coverage in libtor-string to 100%Nick Mathewson
(On linux.)
2018-07-10Rename util_malloc to malloc.Nick Mathewson
2018-07-10File-level summary documentation for src/lib/*/*.[ch]Nick Mathewson
2018-07-09strcasecmp should not take a size_t argumentNick Mathewson
2018-07-05Try to use stricmp variants that MSDN actually recommendsNick Mathewson
Per recommendation by Gisle Vanem
2018-07-03Remove ATTR_NONNULL macrorl1987
2018-07-02Don't redefine str(n)casecmp on windows unless they're missingNick Mathewson
When we do redefine them, use inline functions instead of #define. This fixes a latent code problem in our redefinition of these functions, which was exposed by our refactoring: Previously, we would #define strcasecmp after string.h was included, so nothing bad would happen. But when we refactored, we would sometimes #define it first, which was a problem on mingw, whose headers contain (approximately): inline int strcasecmp (const char *a, const char *b) { return _stricmp(a,b); } Our define turned this into: inline int _stricmp(const char *a, const char *b) { return _stricmp(a,b); } And GCC would correctly infer that this function would loop forever, rather than actually comparing anything. This caused bug 26594. Fixes bug 26594; bug not in any released version of Tor.
2018-06-28Fix macOS includesTaylor Yu
Recent code movement from refactoring missed some includes that seem to be necessary on macOS.
2018-06-27Move various mem* functions to lib/stringNick Mathewson
2018-06-27Move tor_strtok_r to libtor-stringNick Mathewson
2018-06-26Move tor_parse_long and friends into parse_int.h in libtor-stringNick Mathewson
2018-06-22Make an inline static so we can build with coverage enabled.Nick Mathewson
2018-06-22Two more small changes for CI.Nick Mathewson
2018-06-22Extract strlcpy and strlcmp to libtor-stringNick Mathewson
2018-06-22Extract key string manipulation functions into a new library.Nick Mathewson