--- src\libs\zbxcomms\comms.c.orig 2019-10-14 22:42:50 +0500 +++ src\libs\zbxcomms\comms.c 2019-10-14 22:46:25 +0500 @@ -1627,7 +1627,7 @@ } else { - if (0 != (left = MIN(ZBX_TCP_LINE_LEN - s->read_bytes, (size_t)(ptr - buffer)))) + if (ptr && (left = MIN(ZBX_TCP_LINE_LEN - s->read_bytes, (size_t)(ptr - buffer)))) { /* fill the string to the defined limit */ zbx_strncpy_alloc(&s->buffer, &alloc, &offset, buffer, left); @@ -1635,7 +1635,7 @@ } /* if the line exceeds the defined limit then truncate it by skipping data until the newline */ - if (NULL != ptr) + if (ptr) { zbx_strncpy_alloc(&s->buffer, &alloc, &offset, ptr, nbytes - (ptr - buffer)); s->read_bytes += nbytes - (ptr - buffer);