Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37533834
en ru br
Репозитории ALT
S:0.82-alt4
5.1: 0.72-alt3
4.1: 0.72-alt3
4.0: 0.72-alt3
3.0: 0.65-alt1
www.altlinux.org/Changes

Группа :: Мониторинг
Пакет: mtr

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: mtr-0.72-alt-bound.patch
Скачать


--- mtr-0.72/dns.c
+++ mtr-0.72/dns.c
@@ -322,7 +322,7 @@ void *statmalloc(size_t size)
 
   p = malloc(mallocsize);
   if (!p) {
-    fprintf(stderr,"malloc() of %u bytes failed: %s\n", (unsigned int)size, strerror(errno));
+    fprintf(stderr,"malloc() of %u bytes failed: %m\n", (unsigned int)size);
     exit(-1);
   }
   *((dword *)p) = (dword)size;
@@ -478,14 +478,12 @@ void dns_open(void)
     _res.nsaddr_list[i].sin_family = AF_INET;
   resfd = socket(AF_INET, SOCK_DGRAM, 0);
   if (resfd == -1) {
-    fprintf(stderr,"Unable to allocate socket for nameserver communication: %s\n",
-	    strerror(errno));
+    fprintf(stderr,"Unable to allocate socket for nameserver communication: %m\n");
     exit(-1);
   }
   option = 1;
   if (setsockopt(resfd,SOL_SOCKET,SO_BROADCAST,(char *)&option,sizeof(option))) {
-    fprintf(stderr,"Unable to setsockopt() on nameserver communication socket: %s\n",
-	    strerror(errno));
+    fprintf(stderr,"Unable to setsockopt() on nameserver communication socket: %m\n");
     exit(-1);
   }
   longipstr( "127.0.0.1", &localhost, AF_INET );
@@ -503,7 +501,7 @@ struct resolve *allocresolve(void)
 
   rp = (struct resolve *)statmalloc(sizeof(struct resolve));
   if (!rp) {
-    fprintf(stderr,"statmalloc() failed: %s\n",strerror(errno));
+    fprintf(stderr,"statmalloc() failed: %m\n");
     exit(-1);
   }
   memset(rp,0, sizeof(struct resolve));
@@ -877,9 +875,8 @@ void resendrequest(struct resolve *rp,int type)
   if (type == T_A) {
     dorequest(rp->hostname,type,rp->id);
     if (debug) {
-      sprintf(tempstring,"Resolver: Sent reverse authentication request for \"%s\".",
+      fprintf(stderr,"Resolver: Sent reverse authentication request for \"%s\".\r",
 	      rp->hostname);
-      restell(tempstring);
     }
   } else if (type == T_PTR) {
     switch ( af ) {
@@ -898,9 +895,8 @@ void resendrequest(struct resolve *rp,int type)
     }
     dorequest(tempstring,type,rp->id);
     if (debug) {
-      sprintf(tempstring,"Resolver: Sent domain lookup request for \"%s\".",
+      fprintf(stderr,"Resolver: Sent domain lookup request for \"%s\".\r",
 	      strlongip( &(rp->ip) ));
-      restell(tempstring);
     }
   }
 }
@@ -934,8 +930,7 @@ void passrp(struct resolve *rp,long ttl)
   rp->expiretime = sweeptime + (double)ttl;
   untieresolve(rp);
   if (debug) {
-    sprintf(tempstring,"Resolver: Lookup successful: %s\n",rp->hostname);
-    restell(tempstring);
+    fprintf(stderr,"Resolver: Lookup successful: %s\n\r",rp->hostname);
   }
 }
 
@@ -991,9 +986,8 @@ void parserespacket(byte *s, int l)
   case NOERROR:
     if (hp->ancount) {
       if (debug) {
-	sprintf(tempstring,"Resolver: Received nameserver reply. (qd:%u an:%u ns:%u ar:%u)",
+	fprintf(stderr,"Resolver: Received nameserver reply. (qd:%u an:%u ns:%u ar:%u)\r",
                 hp->qdcount,hp->ancount,hp->nscount,hp->arcount);
-	restell(tempstring);
       }
       if (hp->qdcount != 1) {
 	restell("Resolver error: Reply does not contain one query.");
@@ -1031,15 +1025,13 @@ void parserespacket(byte *s, int l)
       namestring[strlen(stackstring)] = '\0';
       if (strcasecmp(stackstring,namestring)) {
 	if (debug) {
-	  sprintf(tempstring,"Resolver: Unknown query packet dropped. (\"%s\" does not match \"%s\")",
+	  fprintf(stderr,"Resolver: Unknown query packet dropped. (\"%s\" does not match \"%s\")\r",
 		  stackstring,namestring);
-	  restell(tempstring);
 	}
 	return;
       }
       if (debug) {
-	sprintf(tempstring,"Resolver: Queried domain name: \"%s\"",namestring);
-	restell(tempstring);
+	fprintf(stderr,"Resolver: Queried domain name: \"%s\"\r",namestring);
       }
       c+= r;
       if (c + 4 > eob) {
@@ -1049,10 +1041,9 @@ void parserespacket(byte *s, int l)
       qdatatype = sucknetword(c);
       qclass = sucknetword(c);
       if (qclass != C_IN) {
-	sprintf(tempstring,"Resolver error: Received unsupported query class: %u (%s)",
+	fprintf(stderr,"Resolver error: Received unsupported query class: %u (%s)\r",
                 qclass,qclass < ClasstypeCount ? classtypes[qclass] :
 		classtypes[ClasstypeCount]);
-	restell(tempstring);
       }
       switch (qdatatype) {
       case T_PTR:
@@ -1063,10 +1054,9 @@ void parserespacket(byte *s, int l)
 	  }
 	break;
       default:
-	sprintf(tempstring,"Resolver error: Received unimplemented query type: %u (%s)",
+	fprintf(stderr,"Resolver error: Received unimplemented query type: %u (%s)\r",
 		qdatatype,qdatatype < ResourcetypeCount ?
 		resourcetypes[qdatatype] : resourcetypes[ResourcetypeCount]);
-	restell(tempstring);
       }
       for (rr = hp->ancount + hp->nscount + hp->arcount;rr;rr--) {
 	if (c > eob) {
@@ -1085,8 +1075,7 @@ void parserespacket(byte *s, int l)
 	else
 	  usefulanswer = 1;
 	if (debug) {
-	  sprintf(tempstring,"Resolver: answered domain query: \"%s\"",namestring);
-	  restell(tempstring);
+	  fprintf(stderr,"Resolver: answered domain query: \"%s\"\r",namestring);
 	}
 	c+= r;
 	if (c + 10 > eob) {
@@ -1098,12 +1087,10 @@ void parserespacket(byte *s, int l)
 	ttl = sucknetlong(c);
 	rdatalength = sucknetword(c);
 	if (class != qclass) {
-	  sprintf(tempstring,"query class: %u (%s)",qclass,qclass < ClasstypeCount ?
+	  fprintf(stderr,"query class: %u (%s)\r",qclass,qclass < ClasstypeCount ?
 		  classtypes[qclass] : classtypes[ClasstypeCount]);
-	  restell(tempstring);
-	  sprintf(tempstring,"rr class: %u (%s)",class,class < ClasstypeCount ?
+	  fprintf(stderr,"rr class: %u (%s)\r",class,class < ClasstypeCount ?
 		  classtypes[class] : classtypes[ClasstypeCount]);
-	  restell(tempstring);
 	  restell("Resolver error: Answered class does not match queried class.");
 	  return;
 	}
@@ -1117,20 +1104,18 @@ void parserespacket(byte *s, int l)
 	}
 	if (datatype == qdatatype || datatype == T_CNAME) {
 	  if (debug) {
-	    sprintf(tempstring,"Resolver: TTL: %s",strtdiff(sendstring,ttl));
-	    restell(tempstring);
+	    fprintf(stderr,"Resolver: TTL: %s\r",strtdiff(sendstring,ttl));
 	  }
 	  if (usefulanswer)
 	    switch (datatype) {
 	    case T_A:
 	      if (rdatalength != 4) {
-		sprintf(tempstring,"Resolver error: Unsupported rdata format for \"A\" type. (%u bytes)",
+		fprintf(stderr,"Resolver error: Unsupported rdata format for \"A\" type. (%u bytes)\r",
 			rdatalength);
-		restell(tempstring);
 		return;
 	      }
 	      if ( addrcmp( (void *) &(rp->ip), (void *) c, af ) == 0 ) {
-		sprintf(tempstring,"Resolver: Reverse authentication failed: %s != ",
+		snprintf(tempstring,sizeof tempstring,"Resolver: Reverse authentication failed: %s != ",
 			strlongip( &(rp->ip) ));
 		addrcpy( (void *) &alignedip, (void *) c, af );
 		strcat(tempstring,strlongip( &alignedip ));
@@ -1138,9 +1123,8 @@ void parserespacket(byte *s, int l)
 		res_hostipmismatch++;
 		failrp(rp);
 	      } else {
-		sprintf(tempstring,"Resolver: Reverse authentication complete: %s == \"%s\".",
+		fprintf(stderr,"Resolver: Reverse authentication complete: %s == \"%s\".\r",
 			strlongip( &(rp->ip) ),nonull(rp->hostname));
-		restell(tempstring);
 		res_reversesuccess++;
 		passrp(rp,ttl);
 		return;
@@ -1155,8 +1139,7 @@ void parserespacket(byte *s, int l)
 		return;
 	      }
 	      if (debug) {
-		sprintf(tempstring,"Resolver: Answered domain: \"%s\"",namestring);
-		restell(tempstring);
+		fprintf(stderr,"Resolver: Answered domain: \"%s\"\r",namestring);
 	      }
 	      if (r > HostnameLength) {
 		restell("Resolver error: Domain name too long.");
@@ -1170,7 +1153,7 @@ void parserespacket(byte *s, int l)
 	      if (!rp->hostname) {
 		rp->hostname = (char *)statmalloc(strlen(namestring) + 1);
 		if (!rp->hostname) {
-		  fprintf(stderr,"statmalloc() error: %s\n",strerror(errno));
+		  fprintf(stderr,"statmalloc() error: %m\n");
 		  exit(-1);
 		}
 		strcpy(rp->hostname,namestring);
@@ -1180,17 +1163,15 @@ void parserespacket(byte *s, int l)
 	      }
 	      break;
 	    default:
-	      sprintf(tempstring,"Resolver error: Received unimplemented data type: %u (%s)",
+	      fprintf(stderr,"Resolver error: Received unimplemented data type: %u (%s)\r",
 		      datatype,datatype < ResourcetypeCount ?
 		      resourcetypes[datatype] : resourcetypes[ResourcetypeCount]);
-	      restell(tempstring);
 	    }
 	} else {
 	  if (debug) {
-	    sprintf(tempstring,"Resolver: Ignoring resource type %u. (%s)",
+	    fprintf(stderr,"Resolver: Ignoring resource type %u. (%s)\r",
 		    datatype,datatype < ResourcetypeCount ?
 		    resourcetypes[datatype] : resourcetypes[ResourcetypeCount]);
-	    restell(tempstring);
 	  }
 	}
 	c+= rdatalength;
@@ -1205,10 +1186,9 @@ void parserespacket(byte *s, int l)
     failrp(rp);
     break;
   default:
-    sprintf(tempstring,"Resolver: Received error response %u. (%s)",
+    fprintf(stderr,"Resolver: Received error response %u. (%s)\r",
 	    getheader_rcode(hp),getheader_rcode(hp) < ResponsecodeCount ?
 	    responsecodes[getheader_rcode(hp)] : responsecodes[ResponsecodeCount]);
-    restell(tempstring);
     res_nserror++;
   }
 }
@@ -1236,14 +1216,12 @@ void dns_ack(void)
 		      (void *) &(from4->sin_addr), AF_INET ) == 0 )
 	  break;
     if (i == _res.nscount) {
-      sprintf(tempstring,"Resolver error: Received reply from unknown source: %s",
+      fprintf(stderr,"Resolver error: Received reply from unknown source: %s\r",
 	      inet_ntoa(from4->sin_addr ));
-      restell(tempstring);
     } else
       parserespacket((byte *)resrecvbuf,r);
   } else {
-    sprintf(tempstring,"Resolver: Socket error: %s",strerror(errno));
-    restell(tempstring);
+    fprintf(stderr,"Resolver: Socket error: %m\r");
   }
 }
 
@@ -1271,10 +1249,9 @@ void dns_events(double *sinterval)
     case STATE_FINISHED:	/* TTL has expired */
     case STATE_FAILED:	/* Fake TTL has expired */
       if (debug) {
-	sprintf(tempstring,"Resolver: Cache record for \"%s\" (%s) has expired. (state: %u)  Marked for expire at: %g, time: %g.",
+	fprintf(stderr,"Resolver: Cache record for \"%s\" (%s) has expired. (state: %u)  Marked for expire at: %g, time: %g.\r",
                 nonull(rp->hostname), strlongip( &(rp->ip) ), 
 		rp->state, rp->expiretime, sweeptime);
-	restell(tempstring);
       }
       unlinkresolve(rp);
       break;
@@ -1315,16 +1292,14 @@ char *dns_lookup2(ip_t * ip)
     if ((rp->state == STATE_FINISHED) || (rp->state == STATE_FAILED)) {
       if ((rp->state == STATE_FINISHED) && (rp->hostname)) {
 	if (debug) {
-	  sprintf(tempstring,"Resolver: Used cached record: %s == \"%s\".\n",
+	  fprintf(stderr,"Resolver: Used cached record: %s == \"%s\".\n\r",
 		  strlongip(ip),rp->hostname);
-	  restell(tempstring);
 	}
 	return rp->hostname;
       } else {
 	if (debug) {
-	  sprintf(tempstring,"Resolver: Used failed record: %s == ???\n",
+	  fprintf(stderr,"Resolver: Used failed record: %s == ???\n\r",
 		  strlongip(ip));
-	  restell(tempstring);
 	}
 	return NULL;
       }
@@ -1365,7 +1340,7 @@ void addr2ip6arpa( ip_t * ip, char * buf ) {
         sprintf( b, "%x.%x.", p[i] % 16, p[i] >> 4 );
         b += 4;
   }
-  sprintf( b, "ip6.arpa" );
+  strcpy(b, "ip6.arpa");
   return;
 }
 #endif
--- mtr-0.72/gtk.c
+++ mtr-0.72/gtk.c
@@ -312,7 +312,7 @@ void gtk_set_field_num(GtkCList *List, int row, int ix, char *format, double num
 {
   char str[32];
 
-  sprintf(str, format, num);
+  snprintf(str, sizeof str, format, num);
   gtk_set_field(List, row, ix, str);
 }
 
--- mtr-0.72/split.c
+++ mtr-0.72/split.c
@@ -103,13 +103,13 @@ void split_redraw(void)
       name = dns_lookup(addr);
       if(name != NULL) {
 	/* May be we should test name's length */
-	sprintf(newLine, "%s %d %d %d %d %d %d", name,
+	snprintf(newLine, sizeof newLine, "%s %d %d %d %d %d %d", name,
 		net_loss(at),
 		net_returned(at), net_xmit(at),
 		net_best(at) /1000, net_avg(at)/1000, 
 		net_worst(at)/1000);
       } else {
-	sprintf(newLine, "%s %d %d %d %d %d %d", 
+	snprintf(newLine, sizeof newLine, "%s %d %d %d %d %d %d", 
 		strlongip( addr ),
 		net_loss(at),
 		net_returned(at), net_xmit(at),
@@ -117,7 +117,7 @@ void split_redraw(void)
 		net_worst(at)/1000);
       }
     } else {
-      sprintf(newLine, "???");
+      strcpy(newLine, "???");
     }
 
     if (strcmp(newLine, Lines[at]) == 0) {
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin