[ic] vlink MINIVEND_SOCKET patch

Peter peter at pajamian.dhs.org
Tue May 5 12:06:46 UTC 2020


compile_link is documented to allow the path to the socket in vlink to 
be overridden with the MINIVEND_SOCKET environment variable, but this 
functionality is non-existent.  Since at the moment I'm attempting to 
package Interchange 5.12.0 for CentOS 8 I'm thinking that this 
functionality would be usefull so that I can simply build vlink for the 
default socket location and if someone wants to change it they can just 
set MINIVEND_SOCKET rather than having to re-compile vlink with the new 
location.  I've come up with the following patch which should do that (I 
haven't tested it yet), and also eliminates a vulnerable strcpy in the 
process:

--- interchange-5.12.0-rc1/dist/src/vlink.c.orig	2020-05-05 
23:09:11.408139523 +1200
+++ interchange-5.12.0-rc1/dist/src/vlink.c	2020-05-05 
23:31:02.794756433 +1200
@@ -140,12 +140,17 @@
    int i;
    int e;
    int r;
+  char *lsocket;
    uid_t euid;
    gid_t egid;

+  lsocket = getenv("MINIVEND_SOCKET");
+  if(lsocket == NULL) {
+    lsocket = LINK_FILE;
+  }

    sa.sun_family = AF_UNIX;
-  strcpy(sa.sun_path, LINK_FILE);
+  strncpy(sa.sun_path, lsocket, sizeof(sa.sun_path) - 1);
  #ifdef offsetof
    size = (offsetof (struct sockaddr_un, sun_path) + strlen 
(sa.sun_path) + 1);
  #else



More information about the interchange-users mailing list