summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: dd6f2b0)
raw | patch | inline | side by side (parent: dd6f2b0)
author | Sebastian Harl <sh@tokkee.org> | |
Sun, 12 Jan 2014 17:37:04 +0000 (18:37 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Sun, 12 Jan 2014 17:37:04 +0000 (18:37 +0100) |
Test performed as:
./configure CC=clang \
CFLAGS="-O0 -g -fsanitize=address -fno-omit-frame-pointer" \
LDFLAGS=-fsanitize=address
make clean all test
See also http://clang.llvm.org/docs/AddressSanitizer.html
./configure CC=clang \
CFLAGS="-O0 -g -fsanitize=address -fno-omit-frame-pointer" \
LDFLAGS=-fsanitize=address
make clean all test
See also http://clang.llvm.org/docs/AddressSanitizer.html
src/frontend/sock.c | patch | blob | history | |
src/utils/unixsock.c | patch | blob | history |
diff --git a/src/frontend/sock.c b/src/frontend/sock.c
index 0c4829e2efc4d3737fb9cf4a5f21cf3df5fa59b5..aa7cab068b115d07d2008eceb78347b99c5c19cd 100644 (file)
--- a/src/frontend/sock.c
+++ b/src/frontend/sock.c
}
listener = realloc(sock->listeners,
- sock->listeners_num * sizeof(*sock->listeners));
+ (sock->listeners_num + 1) * sizeof(*sock->listeners));
if (! listener) {
char buf[1024];
sdb_log(SDB_LOG_ERR, "frontend: Failed to allocate memory: %s",
diff --git a/src/utils/unixsock.c b/src/utils/unixsock.c
index da992c94b51601024bc03e2988ca9ff8d7a1e9d8..62b6f45aa404f360ed1f623c07362dcb2c2e26b0 100644 (file)
--- a/src/utils/unixsock.c
+++ b/src/utils/unixsock.c
buffer[buflen - 1] = '\0';
buflen = strlen(buffer);
- while ((buffer[buflen - 1] == '\n') || (buffer[buflen - 1] == '\r')) {
+ while (buflen && ((buffer[buflen - 1] == '\n') || (buffer[buflen - 1] == '\r'))) {
buffer[buflen - 1] = '\0';
--buflen;
}