1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-02-13 18:33:03 +01:00

gpgscm: Fix possible segv in the process functions.

* tests/gpgscm/ffi.c (do_process_spawn_io): Fix use of FD_ISSET.
--

This bug was detected on an i686 with gcc 4.1 and Linux 2.6.18

Fixes-commit: 1b0ce9918c321a5060fb7c59a234ab683187e8c1
This commit is contained in:
Werner Koch 2025-02-06 15:35:49 +01:00
parent 0ec989ee3f
commit 3a523b43d4
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

@ -1055,7 +1055,7 @@ do_process_spawn_io (scheme *sc, pointer args)
if (ret < 0) if (ret < 0)
break; break;
if (FD_ISSET (out_fd, &read_fdset)) if (out_fd >= 0 && FD_ISSET (out_fd, &read_fdset))
{ {
bytes_read = read (out_fd, out_string + out_off, bytes_read = read (out_fd, out_string + out_off,
out_len - out_off); out_len - out_off);
@ -1079,7 +1079,7 @@ do_process_spawn_io (scheme *sc, pointer args)
} }
} }
if (FD_ISSET (err_fd, &read_fdset)) if (err_fd >= 0 && FD_ISSET (err_fd, &read_fdset))
{ {
bytes_read = read (err_fd, err_string + err_off, bytes_read = read (err_fd, err_string + err_off,
err_len - err_off); err_len - err_off);