java_posix_spawn icon indicating copy to clipboard operation
java_posix_spawn copied to clipboard

Possible memory allocation bug in createPrependedArgv?

Open guillerodriguez opened this issue 11 years ago • 1 comments

This line (https://github.com/axiak/java_posix_spawn/blob/master/src/c/jlinuxfork.c#L303):

pargv[i + 1] = (char *)malloc(3 * fds[i]);

should be allocating memory that is used later to sprintf an integer representing a fd. However the amount of memory allocated seems to be wrong (3 x the actual fd number).

guillerodriguez avatar Aug 12 '14 12:08 guillerodriguez

Perhaps that was meant to be 3 * sizeof(fds[i]) ?

guillerodriguez avatar Sep 05 '14 20:09 guillerodriguez