The given value means kilobytes, rather than bytes. Add checks
for invalid values of the buffer size.
if (!wng)
goto out;
stdin_set_defaults(&sit);
- if (conf.bufsize_given)
- sit.bufsize = conf.bufsize_arg;
+ ret = -ERRNO_TO_PARA_ERROR(EINVAL);
+ if (conf.bufsize_arg < 0)
+ goto out;
+ if (conf.bufsize_arg >= INT_MAX / 1024)
+ goto out;
+ sit.bufsize = conf.bufsize_arg * 1024;
sit.buf = para_malloc(sit.bufsize);
wng->buf = sit.buf;