diff options
author | Werner Koch <[email protected]> | 2025-02-06 14:35:49 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2025-02-06 14:35:49 +0000 |
commit | 3a523b43d44fc4d126dce92706523de860ff577c (patch) | |
tree | b4cf9564a3cb02cd2bc43ea5b242a38c095ceaf2 | |
parent | gpgscm: Fix for gcc < 4.5 (diff) | |
download | gnupg-3a523b43d44fc4d126dce92706523de860ff577c.tar.gz gnupg-3a523b43d44fc4d126dce92706523de860ff577c.zip |
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
-rw-r--r-- | tests/gpgscm/ffi.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/gpgscm/ffi.c b/tests/gpgscm/ffi.c index 1179e01c0..21ec6a057 100644 --- a/tests/gpgscm/ffi.c +++ b/tests/gpgscm/ffi.c @@ -1055,7 +1055,7 @@ do_process_spawn_io (scheme *sc, pointer args) if (ret < 0) 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, 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, err_len - err_off); |