ayttm-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Ayttm-commits] CVS: ayttm/modules/aim-toc/libtoc libtoc.c,1.9,1.10


From: Colin Leroy <address@hidden>
Subject: [Ayttm-commits] CVS: ayttm/modules/aim-toc/libtoc libtoc.c,1.9,1.10
Date: Tue, 25 Mar 2003 18:29:27 -0500

Update of /cvsroot/ayttm/ayttm/modules/aim-toc/libtoc
In directory subversions:/tmp/cvs-serv17844/modules/aim-toc/libtoc

Modified Files:
        libtoc.c 
Log Message:
strcpy/strncpy, strcat/strncat, sprintf/snprintf



Index: libtoc.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/modules/aim-toc/libtoc/libtoc.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- libtoc.c    25 Mar 2003 17:22:48 -0000      1.9
+++ libtoc.c    25 Mar 2003 23:29:25 -0000      1.10
@@ -383,7 +383,7 @@
        int x;
        strcpy(rp, "0x");
        for (x=0;(x<150) && pass[x]; x++)
-               pos+=sprintf(&rp[pos],"%02x", pass[x] ^ roast[x % 
strlen(roast)]);
+               pos+=snprintf(&rp[pos], 256, "%02x", pass[x] ^ roast[x % 
strlen(roast)]);
        rp[pos]='\0';
        return rp;
 }
@@ -588,7 +588,7 @@
                fprintf(stderr, "file_name = %s\n", buff + 186 );
 }
                memset(buff + 62, 0, 32);
-               strcpy(buff + 62, "TIK");
+               strncpy(buff + 62, "TIK", sizeof(buff)-62);
                fh->encryption = 0;
                fh->compression = 0;
                fh->total_num_parts = htons(1);
@@ -785,7 +785,7 @@
                {
                        if(*d == 'g')
                        {
-                               strcpy(group, d+2);
+                               strncpy(group, d+2, sizeof(group));
                                toc_new_group(group);
                        }
                        else if(*d == 'b')
@@ -1187,7 +1187,7 @@
         info=strdup(tinfo);
         // end hack (user info)
 
-       strcpy(conn->server, server);
+       strncpy(conn->server, server, sizeof(conn->server));
        conn->port = port;
 
 
@@ -1352,25 +1352,25 @@
 
        buff[0] = '\0';
        strcat(buff, "g:");
-       strcat(buff, group);
-       strcat(buff, "\n");
+       strncat(buff, group, sizeof(buff)-strlen(buff));
+       strncat(buff, "\n", sizeof(buff)-strlen(buff));
 
        for( node = list; node; node=node->next )
        {
                char * handle = node->data;     
 
-               strcat( buff, "b:");
-               strcat( buff, aim_normalize(handle) );
-               strcat( buff, "\n");
+               strncat( buff, "b:", sizeof(buff)-strlen(buff));
+               strncat( buff, aim_normalize(handle), 
sizeof(buff)-strlen(buff));
+               strncat( buff, "\n", sizeof(buff)-strlen(buff));
 
                if(strlen(buff) > 100 )
                {
                        g_snprintf(buff2, 2048, "toc2_new_buddies {%s}", buff); 
                        send_flap(conn, DATA, buff2);
                        buff[0] = '\0';
-                       strcat(buff, "g:");
-                       strcat(buff, group);
-                       strcat(buff, "\n");
+                       strncat(buff, "g:", sizeof(buff)-strlen(buff));
+                       strncat(buff, group, sizeof(buff)-strlen(buff));
+                       strncat(buff, "\n", sizeof(buff)-strlen(buff));
                }
 
        }
@@ -1398,7 +1398,7 @@
        char buff[2048];
 
        g_snprintf(buff, 2048, "toc_get_info %s", aim_normalize(user));
-       strcpy(user_info_id, user);
+       strncpy(user_info_id, user, sizeof(user_info_id));
        send_flap(conn, DATA, buff);
 }
 
@@ -1407,10 +1407,10 @@
        char buff[2048];
        char buff2[2048];
 
-       strcpy(buff2, aim_normalize(user));
+       strncpy(buff2, aim_normalize(user), sizeof(buff2));
 
        g_snprintf(buff, 2048, "toc2_remove_buddy %s \"%s\"", buff2, group);
-       strcpy(user_info_id, user);
+       strncpy(user_info_id, user, sizeof(user_info_id));
        send_flap(conn, DATA, buff);
 }
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]