[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE_3_1_BRANCH: kdenetwork/krfb/srvloc [POSSIBLY UNSAFE]
From:       Lubos Lunak <l.lunak () kde ! org>
Date:       2002-12-06 16:01:45
[Download RAW message or body]

CVS commit by lunakl: 

Max size limits for scanf().
Correct arguments to scanf() - people, can't you read the warnings?
Got rid of two more warnings.


  M +7 -6      kinetaddr_ipfinder.cpp   1.2.4.1 [POSSIBLY UNSAFE]


--- kdenetwork/krfb/srvloc/kinetaddr_ipfinder.cpp:1.2	Mon Jul 15 20:50:34 2002
@@ -4,7 +4,7 @@
  *  based on code from KInetSocketAddress:
  *    Copyright (C) 2000,2001 Thiago Macieira <thiagom@mail.com>
  *
- *  $Id: kinetaddr_ipfinder.cpp,v 1.2 2002/07/15 18:50:34 tjansen Exp $
+ *  $Id: kinetaddr_ipfinder.cpp,v 1.2.4.1 2002/12/06 16:01:45 lunakl Exp $
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Library General Public
@@ -61,8 +61,8 @@
 #endif
 
 
-static char *local_address = NULL;
-static char *inet_address = NULL;
+static const char *local_address = NULL;
+static const char *inet_address = NULL;
 
 /* max number of network interfaces*/
 #define MAX_IF 8
@@ -85,7 +85,8 @@
 	FILE *fp = fopen( PROCROUTE, "r");
 	char buff[4096], gate_addr[128], net_addr[128];
 	char mask_addr[128];
-	int irtt, window, mss, num, metric, iflags, refcnt, use;
+	int irtt, window, mss, num, metric, refcnt, use;
+        unsigned int iflags;
 	char i;
 	if( !fp ) {
 		return NULL;
@@ -93,9 +94,9 @@
 	i=0;
 // cruise through the list, and find the gateway interface
 	while( fgets(buff, 1023, fp) ) {
-		num = sscanf(buff, "%s %s %s %X %d %d %d %s %d %d %d\n",
+		num = sscanf(buff, "%15s %127s %127s %X %d %d %d %127s %d %d %d\n",
 			iface, net_addr, gate_addr, &iflags, &refcnt, &use, &metric,
-			&mask_addr, &mss, &window, &irtt);
+			mask_addr, &mss, &window, &irtt);
 		i++;
 		if( i == 1) continue;
 

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic