use fclose to pipe of popen is a serious bug?
Some months ago I write a cgi application for linux that uses popen to
read the output of a command, and then I close the pipe with fclose. Now,
I read that for close pipes is needs use pclose.
The manual says:
The return value from popen() is a normal standard I/O stream in all
respects save that it must be closed with pclose() rather than fclose(3).
My code is like this:
if ((NULL != (f = popen(command.value, "r")))) {
//do something
fclose(f);
}
My question is: my mistake have a security concern? It program is
currently in production. In tests it not do anything problem. Is really
needed, patch it using pclose instead fclose ? Note: I only open the pipe
one time in the program.
Today, in my local home I do some test and fclose and pclose not return
EOF indicating failure.
No comments:
Post a Comment