From 572e5648458cab1d530f1cb219efafc853030ba0 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Wed, 29 Aug 2001 02:25:59 +0000 Subject: Initialize buf and diag_buf to NULL, hopefully this fixes the crash if the 2001-08-28 Jeffrey Stedfast * camel-pgp-context.c (crypto_exec_with_passwd): Initialize buf and diag_buf to NULL, hopefully this fixes the crash if the select() times out. svn path=/trunk/; revision=12508 --- camel/ChangeLog | 6 ++++++ camel/camel-pgp-context.c | 22 +++++++++++----------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/camel/ChangeLog b/camel/ChangeLog index bdabbdf140..d347c98956 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,9 @@ +2001-08-28 Jeffrey Stedfast + + * camel-pgp-context.c (crypto_exec_with_passwd): Initialize buf + and diag_buf to NULL, hopefully this fixes the crash if the + select() times out. + 2001-08-28 Peter Williams * providers/imap/camel-imap-store.c (create_folder): Whoops. diff --git a/camel/camel-pgp-context.c b/camel/camel-pgp-context.c index 3d048039d1..a8fef60ee4 100644 --- a/camel/camel-pgp-context.c +++ b/camel/camel-pgp-context.c @@ -277,17 +277,17 @@ crypto_exec_with_passwd (const char *path, char *argv[], const char *input, int int passwd_fds[], const char *passphrase, char **output, int *outlen, char **diagnostics) { - fd_set fdset, write_fdset; - int ip_fds[2], op_fds[2], diag_fds[2]; - int select_result, read_len, write_len; - size_t tmp_len; - pid_t child; - char *buf, *diag_buf; - const char *passwd_next, *input_next; - size_t size, alloc_size, diag_size, diag_alloc_size; gboolean eof_seen, diag_eof_seen, passwd_eof_seen, input_eof_seen; size_t passwd_remaining, passwd_incr, input_remaining, input_incr; + size_t size, alloc_size, diag_size, diag_alloc_size; + int select_result, read_len, write_len; + int ip_fds[2], op_fds[2], diag_fds[2]; + const char *passwd_next, *input_next; + char *buf = NULL, *diag_buf = NULL; + fd_set fdset, write_fdset; struct timeval timeout; + size_t tmp_len; + pid_t child; if ((pipe (ip_fds) < 0 ) || @@ -409,7 +409,7 @@ crypto_exec_with_passwd (const char *path, char *argv[], const char *input, int size += read_len; } - if (FD_ISSET(diag_fds[0], &fdset) ) { + if (FD_ISSET (diag_fds[0], &fdset) ) { /* More stderr is available. */ if (diag_size + 1024 > diag_alloc_size) { @@ -430,7 +430,7 @@ crypto_exec_with_passwd (const char *path, char *argv[], const char *input, int diag_size += read_len; } - if (FD_ISSET(passwd_fds[1], &write_fdset)) { + if (FD_ISSET (passwd_fds[1], &write_fdset)) { /* Ready for more password input. */ tmp_len = passwd_incr; @@ -451,7 +451,7 @@ crypto_exec_with_passwd (const char *path, char *argv[], const char *input, int } } - if (FD_ISSET(ip_fds[1], &write_fdset)) { + if (FD_ISSET (ip_fds[1], &write_fdset)) { /* Ready for more ciphertext input. */ tmp_len = input_incr; -- cgit v1.2.3