summaryrefslogtreecommitdiff
path: root/src/input/input_smb.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/input/input_smb.c')
-rw-r--r--src/input/input_smb.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/input/input_smb.c b/src/input/input_smb.c
index 9d6f3d9a6..b7c864f50 100644
--- a/src/input/input_smb.c
+++ b/src/input/input_smb.c
@@ -70,6 +70,8 @@ smb_plugin_read (input_plugin_t *this_gen, void *buf_gen, off_t len)
char *buf = (char *)buf_gen;
off_t n, num_bytes;
+ if (len < 0)
+ return -1;
num_bytes = 0;
while (num_bytes < len)
@@ -90,6 +92,11 @@ smb_plugin_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo,
off_t total_bytes;
buf_element_t *buf = fifo->buffer_pool_alloc (fifo);
+ if (todo < 0 || todo > buf->size) {
+ buf->free_buffer (buf);
+ return NULL;
+ }
+
buf->content = buf->mem;
buf->type = BUF_DEMUX_BLOCK;