summaryrefslogtreecommitdiff
path: root/src/common/util.c
AgeCommit message (Collapse)Author
2014-10-20Improve date validation in HTTP headersteor
Check all date/time values passed to tor_timegm and parse_rfc1123_time for validity, taking leap years into account. Improves HTTP header validation. Avoid unlikely signed integer overflow in tor_timegm on systems with 32-bit time_t. Fixes bug 13476.
2014-10-13Clean whitespace in last patch.Nick Mathewson
2014-10-12Avoid overflow in format_time_interval, create unit teststeor
Fix an instance of integer overflow in format_time_interval() when taking the absolute value of the supplied signed interval value. Fixes bug 13393. Create unit tests for format_time_interval().
2014-09-11Merge remote-tracking branch 'public/bug13104_025'Nick Mathewson
2014-09-11Avoid an overflow on negation in format_helper_exit_statusNick Mathewson
Part of 13104; patch from teor.
2014-09-10Avoid overflows and underflows in sscanf and friendsNick Mathewson
(Patch from teor on 13104)
2014-09-09Use S?SIZE_MAX, not S?SIZE_T_MAXNick Mathewson
This fixes bug 13102 (not on any released Tor) where using the standard SSIZE_MAX name broke mingw64, and we didn't realize. I did this with perl -i -pe 's/SIZE_T_MAX/SIZE_MAX/' src/*/*.[ch] src/*/*/*.[ch]
2014-09-02Add more assertions to esc_for_log to please the clangalyzer.Nick Mathewson
2014-09-02Add an assertion to read_file_to_str_until_eofNick Mathewson
The clangalyzer doesn't believe our math here. I'm pretty sure our math is right. Also, add some unit tests.
2014-09-02Apply the MALLOC_ZERO_WORKS fixup to tor_realloc as well.Nick Mathewson
Also, make MALLOC_ZERO_WORKS never get applied when clang analyzer is running. This should make the clangalyzer a little happier.
2014-08-21Check return values for fcntl in tor_spawn_background.Nick Mathewson
[CID 718609]
2014-08-13Fix whitespace issuesNick Mathewson
2014-08-13Apply coccinelle script to replace malloc(a*b)->calloc(a,b)Nick Mathewson
2014-08-13Add reallocarray clone so we can stop doing multiply-then-reallocateNick Mathewson
2014-06-20Remove code for Windows CE supportNick Mathewson
As far as I know, nobody has used this in ages. It would be a pretty big surprise if it had worked. Closes ticket 11446.
2014-06-14Merge branch 'bug8746_v2_squashed'Nick Mathewson
Conflicts: src/common/include.am
2014-06-14On Windows, terminate processes by handle, not pidNick Mathewson
When we create a process yourself with CreateProcess, we get a handle to the process in the PROCESS_INFO output structure. But instead of using that handle, we were manually looking up a _new_ handle based on the process ID, which is a poor idea, since the process ID might refer to a new process later on, but the handle can't.
2014-06-14Use waitpid code to learn when a controlled process diesNick Mathewson
This lets us avoid sending SIGTERM to something that has already died, since we realize it has already died, and is a fix for the unix version of #8746.
2014-05-14Merge branch 'bug11946'Nick Mathewson
2014-05-14whitespace fixNick Mathewson
2014-05-14Use tor_getpw{nam,uid} wrappers to fix bug 11946Nick Mathewson
When running with User set, we frequently try to look up our information in the user database (e.g., /etc/passwd). The seccomp2 sandbox setup doesn't let us open /etc/passwd, and probably shouldn't. To fix this, we have a pair of wrappers for getpwnam and getpwuid. When a real call to getpwnam or getpwuid fails, they fall back to a cached value, if the uid/gid matches. (Granting access to /etc/passwd isn't possible with the way we handle opening files through the sandbox. It's not desirable either.)
2014-05-12Merge branch 'bug9781_v2'Nick Mathewson
2014-05-12Log an error reply from tor-fw-helper correctly.Nick Mathewson
Fix for bug 9781; bugfix on cd05f35d2cdf50 in 0.2.4.2-alpha.
2014-05-11Quench clang's complaints with -Wshorten-64-to-32 when time_t is not long.dana koch
On OpenBSD 5.4, time_t is a 32-bit integer. These instances contain implicit treatment of long and time_t as comparable types, so explicitly cast to time_t.
2014-05-06Split portfw-error-logging code into a new function.Nick Mathewson
No code has changed; only moved. Part of a fix for 9781.
2014-05-01Merge remote-tracking branch 'public/bug11233_diagnose'Nick Mathewson
2014-04-29Merge remote-tracking branch 'public/bug11605_024'Nick Mathewson
2014-04-25Make compilation of tor_memdup_nulterm() with dmallocNick Mathewson
Fixes bug 11605; bugfix on 0.2.4.10-alpha.
2014-04-16Make sure everything using an interned string is preceded by a logNick Mathewson
(It's nice to know what we were about to rename before we died from renaming it.)
2014-03-31Merge branch 'bug8787_squashed'Nick Mathewson
2014-03-31Always check returns from unlink()Andrea Shepard
2014-03-27Better log message when writing a CR in text mode on windowsNick Mathewson
Help to diagnose #11233
2014-03-25Fix warnings from doxygenNick Mathewson
Most of these are simple. The only nontrivial part is that our pattern for using ENUM_BF was confusing doxygen by making declarations that didn't look like declarations.
2014-02-20fixed long -> int implicit cast warning line 3453Nick Hopper
2013-12-05Set CREATE_NO_WINDOW in tor_spawn_background.David Fifield
This flag prevents the creation of a console window popup on Windows. We need it for pluggable transport executables--otherwise you get blank console windows when you launch the 3.x browser bundle with transports enabled. http://msdn.microsoft.com/en-us/library/ms684863.aspx#CREATE_NO_WINDOW The browser bundles that used Vidalia used to set this flag when launching tor itself; it was apparently inherited by the pluggable transports launched by tor. In the 3.x bundles, tor is launched by some JavaScript code, which doesn't have the ability to set CREATE_NO_WINDOW. tor itself is now being compiled with the -mwindows option, so that it is a GUI application, not a console application, and doesn't show a console window in any case. This workaround doesn't work for pluggable transports, because they need to be able to write control messages to stdout. https://trac.torproject.org/projects/tor/ticket/9444#comment:30
2013-11-22Avoid warning about impossible check for flags & 0Nick Mathewson
Fixes CID 743381
2013-11-18Fix whitespaceNick Mathewson
2013-11-18Merge branch 'backtrace_squashed'Nick Mathewson
Conflicts: src/common/sandbox.c src/common/sandbox.h src/common/util.c src/or/main.c src/test/include.am src/test/test.c
2013-11-18Refactor format_*_number_sigsafe to have a common implementationNick Mathewson
2013-11-18Make backtrace handler handle signals correctly.Nick Mathewson
This meant moving a fair bit of code around, and writing a signal cleanup function. Still pretty nice from what I can tell, though.
2013-11-18Basic backtrace abilityNick Mathewson
On platforms with the backtrace/backtrace_symbols_fd interface, Tor can now dump stack traces on assertion failure. By default, I log them to DataDir/stack_dump and to stderr.
2013-11-15Merge remote-tracking branch 'origin/maint-0.2.4'Nick Mathewson
Conflicts: src/or/relay.c Conflict changes were easy; compilation fixes required were using using TOR_SIMPLEQ_FIRST to get head of cell queue.
2013-11-15Merge remote-tracking branch 'origin/maint-0.2.3' into maint-0.2.4Nick Mathewson
Conflicts: src/or/or.h src/or/relay.c Conflicts were simple to resolve. More fixes were needed for compilation, including: reinstating the tv_to_msec function, and renaming *_conn_cells to *_chan_cells.
2013-10-11Merge branch 'bug1376'Nick Mathewson
2013-10-11Fix some whitespace; tighten the tests.Nick Mathewson
2013-10-10Merge remote-tracking branch 'origin/maint-0.2.4'Nick Mathewson
2013-10-10Merge remote-tracking branch 'origin/maint-0.2.3' into maint-0.2.4Nick Mathewson
2013-10-10Fix unit test for format_helper_exit_statusNick Mathewson
Fix format_helper_exit_status to allow full HEX_ERRNO_SIZE answers, *and* increase the buffer length again.
2013-10-10Merge remote-tracking branch 'origin/maint-0.2.4'Nick Mathewson
2013-10-10Merge remote-tracking branch 'origin/maint-0.2.3' into maint-0.2.4Nick Mathewson