Close#603
After use, sensitive data should be overwritten, but memset() and hand-written code can be silently stripped out by an optimizing compiler or by the linker.
The sodium_memzero() function tries to effectively zero len bytes starting at pnt, even if optimizations are being applied to the code.
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
* fixed 80 chars width of man page
* fixed default timeout value documented in man page
* fixed terms should be highlighted
* updated options '-w' into man pages
* reordered '-a' in front of '-f' in man page
according to the app's help message, the option '-a' should be in front of '-f'
* updated man page '-n nofile' => '-n number'
* updated date in man page
* updated man page
* updated man page according to the source code
- removed -l from ss-server's man page
- removed -p, -l, -b from ss-manager's man page
- added -d, --fast-open, --acl into ss-manager's man page
* updated option '-w' in man page
redir.c:212:9: error: format ‘%ld’ expects argument of type ‘long int’, but argument 5 has type ‘ssize_t’ [-Werror=format=]
LOGI("redir to %s:%d, len=%ld", ipstr, port, r);
^
* fix `ss-redir -v`.
It's now output messages while redirecting.
This is useful at the time building up a router.
* typo
* inet_ntop() -> dns_ntop()
* removed max().
max(INET_ADDRSTRLEN, INET6_ADDRSTRLEN) => INET6_ADDRSTRLEN
- Added one macro to avoid dangling pointers
- Added two functions to perform NULL pointer check
since the allocation is not guaranteed by C library, although it
is a rare case, just for sanity
- Add NULL pointer check to brealloc() and bfree() and for sanity as well
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
This is an option in the origin configure script, add this to configure.ac to generate
config.h since submodules are sharing the same file.
All checks needed are guaranteed, thus simply add it to the ending of file.
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
errno is never set to zero by any system call or library function,
and it's programmer's resposibility to reset it before doing checks.
Otherwise the error might be misleading.
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
The whole remote_ctx is inserted into the cache and sockaddr_storage contains
both address and port.
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
This may fix#565
It is not recommended to compare two structs via memcmp although they have been
memset to 0.
Added two helper functions to compare sockaddr_storage, one for address only and
the other one takes port into account.
These two functions are based on Unbound version in util/net_help.c, and
comform needs of shadowsocks-libev.
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
code issues found by Clang with
CFLAGS="-Os -Wall -Wextra -Werror=unused-const-variable -Wno-error=unused-parameter"
enabled
The details as follows:
- variable initialization issue, modified them as Clang suggested
- data type mismatch when comparing, fix them either by casting or changing
the data type of index of iterator
- get_sockaddr() in netutils may return -1 thus changed returning type from
size_t to ssize_t, which makes Clang happier
- recvfrom() in udprelay is identical, fix this by creating local variable
for comparison and assign back to buf->len when returning value is acceptable
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>