Author: stsp Date: Mon Jul 25 18:45:57 2011 New Revision: 1150841 URL: http://svn.apache.org/viewvc?rev=1150841&view=rev Log: * subversion/libsvn_auth_gpg_agent/gpg_agent.c (password_get_gpg_agent): We can pass the full BUFFER_SIZE to receive_from_gpg_agent() and send_option() because they will NUL-terminate. (Historically these were arguments to recv() and send() which do not.)
Found by: danielsh Modified: subversion/trunk/subversion/libsvn_auth_gpg_agent/gpg_agent.c Modified: subversion/trunk/subversion/libsvn_auth_gpg_agent/gpg_agent.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_auth_gpg_agent/gpg_agent.c?rev=1150841&r1=1150840&r2=1150841&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_auth_gpg_agent/gpg_agent.c (original) +++ subversion/trunk/subversion/libsvn_auth_gpg_agent/gpg_agent.c Mon Jul 25 18:45:57 2011 @@ -179,7 +179,7 @@ password_get_gpg_agent(const char **pass /* Receive the connection status from the gpg-agent daemon. */ buffer = apr_palloc(pool, BUFFER_SIZE); - if (!receive_from_gpg_agent(sd, buffer, BUFFER_SIZE - 1)) + if (!receive_from_gpg_agent(sd, buffer, BUFFER_SIZE)) { close(sd); return FALSE; @@ -195,7 +195,7 @@ password_get_gpg_agent(const char **pass tty_name = getenv("GPG_TTY"); if (tty_name != NULL) { - if (!send_option(sd, buffer, BUFFER_SIZE - 1, "ttyname", tty_name, pool)) + if (!send_option(sd, buffer, BUFFER_SIZE, "ttyname", tty_name, pool)) { close(sd); return FALSE; @@ -211,7 +211,7 @@ password_get_gpg_agent(const char **pass tty_type = getenv("TERM"); if (tty_type != NULL) { - if (!send_option(sd, buffer, BUFFER_SIZE - 1, "ttytype", tty_type, pool)) + if (!send_option(sd, buffer, BUFFER_SIZE, "ttytype", tty_type, pool)) { close(sd); return FALSE; @@ -231,7 +231,7 @@ password_get_gpg_agent(const char **pass lc_ctype = getenv("LANG"); if (lc_ctype != NULL) { - if (!send_option(sd, buffer, BUFFER_SIZE - 1, "lc-ctype", lc_ctype, pool)) + if (!send_option(sd, buffer, BUFFER_SIZE, "lc-ctype", lc_ctype, pool)) { close(sd); return FALSE; @@ -243,7 +243,7 @@ password_get_gpg_agent(const char **pass if (display != NULL) { request = apr_psprintf(pool, "OPTION display=%s\n", display); - if (!send_option(sd, buffer, BUFFER_SIZE - 1, "display", display, pool)) + if (!send_option(sd, buffer, BUFFER_SIZE, "display", display, pool)) { close(sd); return FALSE; @@ -278,7 +278,7 @@ password_get_gpg_agent(const char **pass close(sd); return FALSE; } - if (!receive_from_gpg_agent(sd, buffer, BUFFER_SIZE - 1)) + if (!receive_from_gpg_agent(sd, buffer, BUFFER_SIZE)) { close(sd); return FALSE;