ports/graphics/sane-backends/patches/patch-backend_pixma_pixma_bjnp_c

20 lines
962 B
Text

Fix segfault during 'scanimage -L' if e.g. a "pflog0" interface exists.
Address family AF_LINK is not expected by prepare_socket() and sa_size().
Crashes during memcpy( &local_sa_copy, local_sa, sa_size(local_sa) );
because sa_size() returns a fallback value that doesn't match the actual size.
Index: backend/pixma/pixma_bjnp.c
--- backend/pixma/pixma_bjnp.c.orig
+++ backend/pixma/pixma_bjnp.c
@@ -2115,6 +2115,11 @@ sanei_bjnp_find_devices (const char **conf_devices,
while ((no_sockets < BJNP_SOCK_MAX) && (interface != NULL))
{
if ( ! (interface -> ifa_flags & IFF_POINTOPOINT) &&
+ ( interface -> ifa_addr -> sa_family == AF_INET
+#ifdef ENABLE_IPV6
+ || interface -> ifa_addr -> sa_family == AF_INET6
+#endif
+ ) &&
( (socket_fd[no_sockets] =
prepare_socket( interface -> ifa_name,
(bjnp_sockaddr_t *) interface -> ifa_addr,