Vanilla Development Maling List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CVS update: Vanilla/tools



Date:	Monday March 15, 1999 @ 4:42
Author:	cameron

Update of /home/netrek/cvsroot/Vanilla/tools
In directory cvs.castle.real-time.com:/var/tmp/cvs-serv797/tools

Modified Files:
	conq_vert.c keyman.c loadchecker.c mergescores.c mess.c 
	message.c newscores.c trimscores.c 
Log Message:
Change all gets() calls to fgets(), review all existing fgets() calls
and fix prevalent defect of using one byte less than the buffer size.
Confirmed on man page that size is actual size.  Even I've done it!


****************************************

Index: Vanilla/tools/conq_vert.c
diff -u Vanilla/tools/conq_vert.c:1.1.1.1 Vanilla/tools/conq_vert.c:1.2
--- Vanilla/tools/conq_vert.c:1.1.1.1	Wed Nov 11 20:44:54 1998
+++ Vanilla/tools/conq_vert.c	Mon Mar 15 04:42:45 1999
@@ -213,7 +213,7 @@
 
 /* Accumulate .conquer stats */
 
-  while(fgets(buff,79,infile)) {
+  while(fgets(buff,81,infile)) {
     buff[35]='\0';
     clean(buff);
     if (buff[0]!='\0') count(buff,&stack);
Index: Vanilla/tools/keyman.c
diff -u Vanilla/tools/keyman.c:1.1.1.1 Vanilla/tools/keyman.c:1.2
--- Vanilla/tools/keyman.c:1.1.1.1	Wed Nov 11 20:44:54 1998
+++ Vanilla/tools/keyman.c	Mon Mar 15 04:42:45 1999
@@ -289,7 +289,7 @@
     printf ("WARNING: This will appent entries to your .catalog file.\n");
     printf ("WARNING: Be certain you want to do this!!!!!!!\n");
     printf ("WARNING: This procedure will alter your RSA_Key_File. Continue?(y/n)");
-    gets(buffer);
+    fgets(buffer, MSG_LEN, stdin);
     if (!strcmp(buffer, "n")) {
       printf ("Ok, exiting...\n");
       exit (0);
@@ -309,7 +309,7 @@
 
       do {
           printf("Enter type of client: ");
-          gets(buffer);
+          fgets(buffer, MSG_LEN, stdin);
           if (strlen(buffer) > KEY_SIZE)
                   printf("Client type must be less than %d characters.\n",KEY_SIZE);
       } while (strlen(buffer) > KEY_SIZE);
@@ -317,7 +317,7 @@
 
       do {
           printf("Enter architecture/OS: ");
-          gets(buffer);
+          fgets(buffer, MSG_LEN, stdin);
           if (strlen(buffer) > KEY_SIZE)
                   printf("Architecture field must be less than %d characters.\n",KEY_SIZE);
       } while (strlen(buffer) > KEY_SIZE);
@@ -326,7 +326,7 @@
 
       do {
         printf("Enter the Creator's ID: ");
-        gets(buffer);
+        fgets(buffer, MSG_LEN, stdin);
         if (strlen(buffer) > KEY_SIZE)
               printf("ID size too long. Use the creator's login\n");
       } while (strlen(buffer)>KEY_SIZE);
@@ -385,7 +385,7 @@
     do {
 	printf ("Client: %s\n", key_list[num].client_type);
         printf("Enter new type of client (<enter> for no change): ");
-        gets(type);
+        fgets(type, 80, stdin);
         if (strlen(type) > KEY_SIZE)
                 printf("Client type must be less than %d characters.\n",KEY_SIZE);
     } while (strlen(type) > KEY_SIZE);
@@ -397,7 +397,7 @@
     do {
 	printf("Arch/OS: %s\n", key_list[num].architecture);
         printf("Enter new architecture/OS (<enter> for no change): ");
-        gets(type);
+        fgets(type, 80, stdin);
         if (strlen(type) > KEY_SIZE)
                 printf("Architecture field must be less than %d characters.\n",KEY_SIZE);
     } while (strlen(type) > KEY_SIZE);
@@ -511,7 +511,7 @@
 
     do {
       printf("Enter the Creator's ID: ");
-      gets(type);
+      fgets(type, 80, stdin);
       if (strlen(type) > KEY_SIZE)
             printf("ID size too long. Use the creator's login\n");
     } while (strlen(type)>KEY_SIZE);
@@ -519,7 +519,7 @@
 
     do {
         printf("Enter type of client:");
-        gets(type);
+        fgets(type, 80, stdin);
         if (strlen(type) > KEY_SIZE)
                 printf("Client type must be less than %d characters.\n",KEY_SIZE);
     } while (strlen(type) > KEY_SIZE);
@@ -527,7 +527,7 @@
 
     do {
         printf("Enter architecture/OS:");
-        gets(type);
+        fgets(type, 80, stdin);
         if (strlen(type) > KEY_SIZE)
                 printf("Architecture field must be less than %d characters.\n",KEY_SIZE);
     } while (strlen(type) > KEY_SIZE);
Index: Vanilla/tools/loadchecker.c
diff -u Vanilla/tools/loadchecker.c:1.1.1.1 Vanilla/tools/loadchecker.c:1.2
--- Vanilla/tools/loadchecker.c:1.1.1.1	Wed Nov 11 20:44:54 1998
+++ Vanilla/tools/loadchecker.c	Mon Mar 15 04:42:45 1999
@@ -63,8 +63,8 @@
     }
     sleep(10);
     
-    fgets(buf, 99, fp); /* First line is some header info */
-    fgets(buf, 99, fp); /* Second line shows where idle is */
+    fgets(buf, 100, fp); /* First line is some header info */
+    fgets(buf, 100, fp); /* Second line shows where idle is */
     
     if (i==-1){  /* We haven't found the id location yet */
       i=0;
@@ -78,8 +78,8 @@
       }
     }
     
-    fgets(buf, 99, fp); /* don't want the third line */
-    fgets(buf, 99, fp); /* only want the 4th line */
+    fgets(buf, 100, fp); /* don't want the third line */
+    fgets(buf, 100, fp); /* only want the 4th line */
     pclose(fp);
 
     buf[i+2] = '\0';
Index: Vanilla/tools/mergescores.c
diff -u Vanilla/tools/mergescores.c:1.2 Vanilla/tools/mergescores.c:1.3
--- Vanilla/tools/mergescores.c:1.2	Fri Jan 29 19:30:17 1999
+++ Vanilla/tools/mergescores.c	Mon Mar 15 04:42:45 1999
@@ -154,7 +154,7 @@
     }
 
     fprintf(stderr, "Processing foreign players...\n");
-    while (fgets(buf, MAXBUFFER-1, stdin)) {
+    while (fgets(buf, MAXBUFFER, stdin)) {
 	if (strlen(buf) > 0) buf[strlen(buf)-1] = '\0';
 	trimblanks2(buf+16);
 	trimblanks(buf+33);
Index: Vanilla/tools/mess.c
diff -u Vanilla/tools/mess.c:1.2 Vanilla/tools/mess.c:1.3
--- Vanilla/tools/mess.c:1.2	Fri Jan 29 19:30:17 1999
+++ Vanilla/tools/mess.c	Mon Mar 15 04:42:45 1999
@@ -48,7 +48,7 @@
 
     openmem(0);
     printf("Who are you sending the message to? ");
-    fgets(buf, MSG_LEN + 20 - 1, stdin);
+    fgets(buf, MSG_LEN + 20, stdin);
     if (strlen(buf) > 0) buf[strlen(buf)-1] = '\0';
     to=buf;
     while ((*to!='\0') && j<MAXRECIP) {
Index: Vanilla/tools/message.c
diff -u Vanilla/tools/message.c:1.2 Vanilla/tools/message.c:1.3
--- Vanilla/tools/message.c:1.2	Fri Jan 29 19:30:17 1999
+++ Vanilla/tools/message.c	Mon Mar 15 04:42:45 1999
@@ -22,11 +22,11 @@
 
     openmem(0);
     printf("Enter Message:\n");
-    fgets(message, MSG_LEN + 20 - 1, stdin);
+    fgets(message, MSG_LEN + 20, stdin);
     if (strlen(message) > 0) message[strlen(message)-1] = '\0';
     message[79]='\0';
     printf("Who are you sending the message to? ");
-    fgets(buf, MSG_LEN + 20 - 1, stdin);
+    fgets(buf, MSG_LEN + 20, stdin);
     if (strlen(buf) > 0) buf[strlen(buf)-1] = '\0';
     to=buf;
     while (*to!='\0') {
Index: Vanilla/tools/newscores.c
diff -u Vanilla/tools/newscores.c:1.2 Vanilla/tools/newscores.c:1.3
--- Vanilla/tools/newscores.c:1.2	Fri Jan 29 19:39:49 1999
+++ Vanilla/tools/newscores.c	Mon Mar 15 04:42:45 1999
@@ -82,7 +82,7 @@
 	exit(1);
     }
 
-    while (fgets(buf, MAXBUFFER-1, stdin)) {
+    while (fgets(buf, MAXBUFFER, stdin)) {
 	if (strlen(buf) > 0) buf[strlen(buf)-1] = '\0';
 	trimblanks2(buf+16);
 	trimblanks(buf+33);
Index: Vanilla/tools/trimscores.c
diff -u Vanilla/tools/trimscores.c:1.2 Vanilla/tools/trimscores.c:1.3
--- Vanilla/tools/trimscores.c:1.2	Fri Jan 29 19:30:17 1999
+++ Vanilla/tools/trimscores.c	Mon Mar 15 04:42:45 1999
@@ -86,7 +86,7 @@
     }
 
     i=0;
-    while (fgets(buf, MAXBUFFER-1, stdin)) {
+    while (fgets(buf, MAXBUFFER, stdin)) {
 	if (strlen(buf) > 0) buf[strlen(buf)-1] = '\0';
 	trimblanks2(buf+16);
 	trimblanks(buf+33);