diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/container/buffers.c | 2 | ||||
-rw-r--r-- | src/lib/fdio/fdio.c | 6 | ||||
-rw-r--r-- | src/lib/net/address.c | 2 |
3 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/container/buffers.c b/src/lib/container/buffers.c index 67887f2f30..fe4cf7c385 100644 --- a/src/lib/container/buffers.c +++ b/src/lib/container/buffers.c @@ -689,6 +689,8 @@ buf_move_all(buf_t *buf_out, buf_t *buf_in) tor_assert(buf_out); if (!buf_in) return; + if (buf_datalen(buf_in) == 0) + return; if (BUG(buf_out->datalen >= INT_MAX || buf_in->datalen >= INT_MAX)) return; if (BUG(buf_out->datalen >= INT_MAX - buf_in->datalen)) diff --git a/src/lib/fdio/fdio.c b/src/lib/fdio/fdio.c index 6c87af791d..d723d04d2a 100644 --- a/src/lib/fdio/fdio.c +++ b/src/lib/fdio/fdio.c @@ -43,7 +43,7 @@ off_t tor_fd_getpos(int fd) { #ifdef _WIN32 - return (off_t) _lseek(fd, 0, SEEK_CUR); + return (off_t) _lseeki64(fd, 0, SEEK_CUR); #else return (off_t) lseek(fd, 0, SEEK_CUR); #endif @@ -56,7 +56,7 @@ int tor_fd_seekend(int fd) { #ifdef _WIN32 - return _lseek(fd, 0, SEEK_END) < 0 ? -1 : 0; + return _lseeki64(fd, 0, SEEK_END) < 0 ? -1 : 0; #else off_t rc = lseek(fd, 0, SEEK_END) < 0 ? -1 : 0; #ifdef ESPIPE @@ -75,7 +75,7 @@ int tor_fd_setpos(int fd, off_t pos) { #ifdef _WIN32 - return _lseek(fd, pos, SEEK_SET) < 0 ? -1 : 0; + return _lseeki64(fd, pos, SEEK_SET) < 0 ? -1 : 0; #else return lseek(fd, pos, SEEK_SET) < 0 ? -1 : 0; #endif diff --git a/src/lib/net/address.c b/src/lib/net/address.c index 076ca3eb34..69004ddb0e 100644 --- a/src/lib/net/address.c +++ b/src/lib/net/address.c @@ -337,7 +337,7 @@ tor_addr_to_str(char *dest, const tor_addr_t *addr, size_t len, int decorate) break; case AF_INET6: /* Shortest addr [ :: ] + \0 */ - if (len < (3 + (decorate ? 2 : 0))) + if (len < (3 + (decorate ? 2u : 0u))) return NULL; if (decorate) |