Reproduce error by starting gpg-agent (e.g. gnupg-2.1.11) against GNUPGOME
longer than 96 characters. and S.gpg-agent configuration to sane socket location:
-------->8--------
%Assuan%
socket=/tmp/S.gpg-agnent-test
-------->8--------
Please consider following patch for resolving the problem
- a/src/assuan-socket-connect.c
+++ b/src/assuan-socket-connect.c
@@ -233,13 +233,12 @@ assuan_socket_connect (assuan_context_t ctx, const char *name,
if (af == AF_LOCAL) {
- if (strlen (name)+1 >= sizeof srvr_addr_un.sun_path)
- return _assuan_error (ctx, GPG_ERR_ASS_INV_VALUE);
+ int redirected;
+ if (assuan_sock_set_sockaddr_un (name, (struct sockaddr *)&srvr_addr_un,
&redirected))
+ {
+ return _assuan_error (ctx, GPG_ERR_ASS_INV_VALUE);
+ }
- memset (&srvr_addr_un, 0, sizeof srvr_addr_un);
- srvr_addr_un.sun_family = AF_LOCAL;
- strncpy (srvr_addr_un.sun_path, name, sizeof (srvr_addr_un.sun_path) - 1);
- srvr_addr_un.sun_path[sizeof (srvr_addr_un.sun_path) - 1] = 0; len = SUN_LEN (&srvr_addr_un); srvr_addr = (struct sockaddr *)&srvr_addr_un;