mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
libdaemon: Fix an invalid memory read.
This commit is contained in:
parent
d888a0557e
commit
808a5d945e
@ -38,7 +38,7 @@ int buffer_read(int fd, struct buffer *buffer) {
|
||||
result = read(fd, buffer->mem + buffer->used, buffer->allocated - buffer->used);
|
||||
if (result > 0) {
|
||||
buffer->used += result;
|
||||
if (!strncmp((buffer->mem) + buffer->used - 4, "\n##\n", 4)) {
|
||||
if (buffer->used >= 4 && !strncmp((buffer->mem) + buffer->used - 4, "\n##\n", 4)) {
|
||||
buffer->used -= 4;
|
||||
buffer->mem[buffer->used] = 0;
|
||||
break; /* success, we have the full message now */
|
||||
|
Loading…
Reference in New Issue
Block a user