Blame SOURCES/rpcbind-0.2.0-rpcinfo-buf-overflow.patch

f38772
diff -up rpcbind-0.2.0/src/rpcinfo.c.orig rpcbind-0.2.0/src/rpcinfo.c
f38772
--- rpcbind-0.2.0/src/rpcinfo.c.orig	2009-05-29 09:38:22.000000000 -0400
f38772
+++ rpcbind-0.2.0/src/rpcinfo.c	2019-01-22 11:43:16.000000000 -0500
f38772
@@ -984,6 +984,7 @@ rpcbdump (dumptype, netid, argc, argv)
f38772
 	("   program version(s) netid(s)                         service     owner\n");
f38772
       for (rs = rs_head; rs; rs = rs->next)
f38772
 	{
f38772
+	  size_t netidmax = sizeof(buf) - 1;
f38772
 	  char *p = buf;
f38772
 
f38772
 	  printf ("%10ld  ", rs->prog);
f38772
@@ -996,12 +997,22 @@ rpcbdump (dumptype, netid, argc, argv)
f38772
 	    }
f38772
 	  printf ("%-10s", buf);
f38772
 	  buf[0] = '\0';
f38772
-	  for (nl = rs->nlist; nl; nl = nl->next)
f38772
-	    {
f38772
-	      strcat (buf, nl->netid);
f38772
-	      if (nl->next)
f38772
-		strcat (buf, ",");
f38772
-	    }
f38772
+
f38772
+          for (nl = rs->nlist; nl; nl = nl->next)
f38772
+            {
f38772
+              strncat (buf, nl->netid, netidmax);
f38772
+              if (strlen (nl->netid) < netidmax)
f38772
+                netidmax -= strlen(nl->netid);
f38772
+              else
f38772
+                break;
f38772
+
f38772
+              if (nl->next && netidmax > 1)
f38772
+                {
f38772
+                  strncat (buf, ",", netidmax);
f38772
+                  netidmax --;
f38772
+                }
f38772
+            }
f38772
+
f38772
 	  printf ("%-32s", buf);
f38772
 	  rpc = getrpcbynumber (rs->prog);
f38772
 	  if (rpc)