Skip to content

Commit 3cdff74

Browse files
committed
drivers/ipc: validate pipe ioctl args
1 parent 94df46c commit 3cdff74

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

components/drivers/ipc/pipe.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,19 @@ static int pipe_fops_ioctl(struct dfs_file *fd, int cmd, void *args)
193193
switch ((rt_ubase_t)cmd)
194194
{
195195
case FIONREAD:
196+
if (args == RT_NULL)
197+
{
198+
ret = -EINVAL;
199+
break;
200+
}
196201
*((int*)args) = rt_ringbuffer_data_len(pipe->fifo);
197202
break;
198203
case FIONWRITE:
204+
if (args == RT_NULL)
205+
{
206+
ret = -EINVAL;
207+
break;
208+
}
199209
*((int*)args) = rt_ringbuffer_space_len(pipe->fifo);
200210
break;
201211
default:

0 commit comments

Comments
 (0)