[OpenSIPS-Devel] [opensips] added exec(cmd, output, input, avpenv) function for exec module (#360)

Walter Doekes notifications at github.com
Thu Oct 16 16:11:49 CEST 2014


> +
> +		if (ferror(pin)) {
> +			LM_ERR("writing pipe: %s\n", strerror(errno));
> +			ser_error=E_EXEC;
> +			goto error;
> +		}
> +		pclose(pin);
> +	}
> +
> +	schedule_to_kill(pid);
> +	wait(&exit_status);
> +
> +	if (outvar) {
> +		while (fgets(tmpbuf, MAX_LINE_SIZE, pout)) {
> +			tmplen = strlen(tmpbuf);
> +			memcpy(buf+buflen, tmpbuf, tmplen);

Who checks that buf doesn't overflow? And use fread instead of fgets, since you don't care about there the line feeds are.

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/360/files#r18957149
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/devel/attachments/20141016/6fdf927c/attachment.htm>


More information about the Devel mailing list