Blame SOURCES/libtirpc-0.2.4-badfree.patch

4dfe21
diff -up libtirpc-0.2.4/src/getnetconfig.c.orig libtirpc-0.2.4/src/getnetconfig.c
4dfe21
--- libtirpc-0.2.4/src/getnetconfig.c.orig	2018-12-17 10:42:21.296108473 -0500
4dfe21
+++ libtirpc-0.2.4/src/getnetconfig.c	2018-12-17 10:51:36.397454242 -0500
4dfe21
@@ -682,6 +682,7 @@ struct netconfig	*ncp;
4dfe21
 {
4dfe21
     struct netconfig	*p;
4dfe21
     char	*tmp;
4dfe21
+    char	*t;
4dfe21
     u_int	i;
4dfe21
 
4dfe21
     if ((tmp=malloc(MAXNETCONFIGLINE)) == NULL)
4dfe21
@@ -701,22 +702,21 @@ struct netconfig	*ncp;
4dfe21
      */
4dfe21
     *p = *ncp;
4dfe21
     p->nc_netid = (char *)strcpy(tmp,ncp->nc_netid);
4dfe21
-    tmp = strchr(tmp, 0) + 1;
4dfe21
-    p->nc_protofmly = (char *)strcpy(tmp,ncp->nc_protofmly);
4dfe21
-    tmp = strchr(tmp, 0) + 1;
4dfe21
-    p->nc_proto = (char *)strcpy(tmp,ncp->nc_proto);
4dfe21
-    tmp = strchr(tmp, 0) + 1;
4dfe21
-    p->nc_device = (char *)strcpy(tmp,ncp->nc_device);
4dfe21
+    t = strchr(tmp, 0) + 1;
4dfe21
+    p->nc_protofmly = (char *)strcpy(t,ncp->nc_protofmly);
4dfe21
+    t = strchr(t, 0) + 1;
4dfe21
+    p->nc_proto = (char *)strcpy(t,ncp->nc_proto);
4dfe21
+    t = strchr(t, 0) + 1;
4dfe21
+    p->nc_device = (char *)strcpy(t,ncp->nc_device);
4dfe21
     p->nc_lookups = (char **)malloc((size_t)(p->nc_nlookups+1) * sizeof(char *));
4dfe21
     if (p->nc_lookups == NULL) {
4dfe21
-	free(p->nc_netid);
4dfe21
 	free(p);
4dfe21
 	free(tmp);
4dfe21
 	return(NULL);
4dfe21
     }
4dfe21
     for (i=0; i < p->nc_nlookups; i++) {
4dfe21
-    	tmp = strchr(tmp, 0) + 1;
4dfe21
-    	p->nc_lookups[i] = (char *)strcpy(tmp,ncp->nc_lookups[i]);
4dfe21
+	t = strchr(t, 0) + 1;
4dfe21
+	p->nc_lookups[i] = (char *)strcpy(t,ncp->nc_lookups[i]);
4dfe21
     }
4dfe21
     return(p);
4dfe21
 }