summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/disp-nis.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/disp-nis.c b/src/disp-nis.c
index 5e0c883..b584765 100644
--- a/src/disp-nis.c
+++ b/src/disp-nis.c
@@ -770,10 +770,12 @@ client_read(struct plugin_state *state, struct dispatch_client *client)
client->client_query = query;
client->client_query_size = nlen;
/* Drop the fragment from the incoming
- * buffer. */
- memmove(client->client_inbuf,
- client->client_inbuf + (len + 4),
- client->client_inbuf_used - (len + 4));
+ * buffer by moving the rest forward. */
+ if ((len + 4) < client->client_inbuf_used) {
+ memmove(client->client_inbuf,
+ client->client_inbuf + (len + 4),
+ client->client_inbuf_used - (len + 4));
+ }
client->client_inbuf_used -= (len + 4);
}
if (last) {