projects
/
collectd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a21477b
)
libcollectdclient: Fix off-by-one error when reading the username.
author
Florian Forster
<octo@collectd.org>
Tue, 2 May 2017 08:26:40 +0000
(10:26 +0200)
committer
Florian Forster
<octo@collectd.org>
Tue, 2 May 2017 08:26:40 +0000
(10:26 +0200)
The allocated buffer includes a null byte, but the network packet doesn't.
That means we were reading one byte too many from the buffer, overwriting
the terminating null byte in the buffer.
src/libcollectdclient/network_parse.c
patch
|
blob
|
history
diff --git
a/src/libcollectdclient/network_parse.c
b/src/libcollectdclient/network_parse.c
index
7139c9b
..
83a05d4
100644
(file)
--- a/
src/libcollectdclient/network_parse.c
+++ b/
src/libcollectdclient/network_parse.c
@@
-441,7
+441,7
@@
static int parse_encrypt_aes256(void *data, size_t data_size,
return ENOMEM;
char username[((size_t)username_len) + 1];
memset(username, 0, sizeof(username));
- if (buffer_next(b, username,
sizeof(username)
))
+ if (buffer_next(b, username,
(size_t)username_len
))
return EINVAL;
char const *password = opts->password_lookup(username);