ayttm-commits
[Top][All Lists]
Advanced

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

[Ayttm-commits] CVS: ayttm/modules/msn2 msn.C,1.91,1.92


From: Colin Leroy <address@hidden>
Subject: [Ayttm-commits] CVS: ayttm/modules/msn2 msn.C,1.91,1.92
Date: Tue, 25 Mar 2003 17:39:52 -0500

Update of /cvsroot/ayttm/ayttm/modules/msn2
In directory subversions:/tmp/cvs-serv856

Modified Files:
        msn.C 
Log Message:
sprintf => snprintf
strcpy  => strncpy



Index: msn.C
===================================================================
RCS file: /cvsroot/ayttm/ayttm/modules/msn2/msn.C,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -r1.91 -r1.92
--- msn.C       24 Mar 2003 08:40:41 -0000      1.91
+++ msn.C       25 Mar 2003 22:39:50 -0000      1.92
@@ -820,13 +820,13 @@
 
        ela->handle = value_pair_get_value( values, "SCREEN_NAME" );
        c = value_pair_get_value( values, "PASSWORD");
-       strcpy( mlad->password, c);
+       strncpy( mlad->password, c, sizeof(mlad->password));
        g_free (c); c = NULL;
        
        /*the alias will be the persons login minus the @hotmail.com */
-       strcpy( buff, ela->handle );
+       strncpy( buff, ela->handle , sizeof(buff));
        c = strtok( buff, "@" );
-       strcpy(ela->alias, buff );
+       strncpy(ela->alias, buff , sizeof(ela->alias));
 
        mlad->status = MSN_OFFLINE;
        ela->protocol_local_account_data = mlad;
@@ -844,12 +844,12 @@
 
        val = g_new0( value_pair, 1 );
        strcpy(val->key, "SCREEN_NAME" );
-       strcpy(val->value, account->handle );
+       strncpy(val->value, account->handle, sizeof(val->value));
        vals = l_list_append( vals, val );
 
        val = g_new0( value_pair, 1 );
        strcpy(val->key, "PASSWORD");
-       strcpy(val->value, mlad->password );
+       strncpy(val->value, mlad->password, sizeof(val->value));
        vals = l_list_append( vals, val );
 
        return vals;
@@ -1044,7 +1044,8 @@
 }
 
 void ext_filetrans_success(invitation_ftp * inv) {
-       sprintf(buf, _("The file %s has been successfully transfered."), 
inv->filename);
+       char buf[1024];
+       snprintf(buf, sizeof(buf), _("The file %s has been successfully 
transfered."), inv->filename);
        do_error_dialog(buf, _("File transfered"));
        transfer_window * t_win = eb_find_window_by_inv(inv);
        if (t_win) {
@@ -1055,7 +1056,8 @@
 
 void ext_filetrans_failed(invitation_ftp * inv, int err, char * msg)
 {
-        sprintf(buf, "File transfer failed: %s\n\n(The file sender must have a 
public IP, and his firewall must allow TCP connections to port 6891.)", msg);
+       char buf[1024];
+        snprintf(buf, sizeof(buf), "File transfer failed: %s\n\n(The file 
sender must have a public IP, and his firewall must allow TCP connections to 
port 6891.)", msg);
         do_error_dialog(buf, "Transfer failed");
        transfer_window * t_win = eb_find_window_by_inv(inv);
        if (t_win) {
@@ -1275,7 +1277,7 @@
   if(!is_waiting_auth(username)) {
          char *tmp = Utf8ToStr(friendlyname);
          eb_debug(DBG_MSN, "** %s (%s) has added you to their list.\n", 
friendlyname, username);
-         sprintf(dialog_message, _("The MSN user %s (%s) would like to add you 
to their contact list.\n\nDo you want to allow them to see when you are 
online?"), 
+         snprintf(dialog_message, sizeof(dialog_message), _("The MSN user %s 
(%s) would like to add you to their contact list.\n\nDo you want to allow them 
to see when you are online?"), 
                          tmp, username);
          free(tmp);
          uname = strdup(username);
@@ -1340,12 +1342,12 @@
        for (walk = msn_grouplist; walk && walk->data; walk=walk->next) {
                value_pair *grpinfo = (value_pair *)walk->data;
                if(grpinfo && !strcmp(grpinfo->value, group)) {
-                       strcpy(groupname, grpinfo->key);
+                       strncpy(groupname, grpinfo->key, sizeof(groupname));
                        eb_debug(DBG_MSN,"found group id %s: %s\n",group, 
groupname);
                }
        }
        if (groupname == NULL || !groupname[0] || !strcmp("~", groupname))
-               strcpy(groupname,_("Buddies"));
+               strncpy(groupname,_("Buddies"), sizeof(groupname));
        if(!find_grouplist_by_name(groupname))
                add_group(groupname);
        add_unknown(ea);
@@ -1415,9 +1417,9 @@
                        ext_got_group("-1",enc);
                        free(enc);
                }
-               strcpy(tomove->handle, ea->handle);
-               strcpy(tomove->newgr, int_new_group);
-               strcpy(tomove->oldgr, int_old_group);
+               strncpy(tomove->handle, ea->handle, sizeof(tomove->handle));
+               strncpy(tomove->newgr, int_new_group, sizeof(tomove->newgr));
+               strncpy(tomove->oldgr, int_old_group, sizeof(tomove->oldgr));
                eb_timeout_add(1000, (eb_timeout_function)finish_group_move, 
(gpointer)tomove);
                return;
        } 
@@ -1787,7 +1789,7 @@
        {
                ea = (eb_account *)malloc(sizeof(eb_account));
                mad = g_new0(eb_msn_account_data, 1);
-               strcpy(ea->handle, buddy);
+               strncpy(ea->handle, buddy, sizeof(ea->handle));
                ea->service_id = SERVICE_INFO.protocol_id;
                mad->status = MSN_ONLINE;
                ea->protocol_account_data = mad;
@@ -1855,7 +1857,7 @@
       msn_add_to_llist(chatrooms, emc);
       
       char *roomname = next_chatroom_name();
-      strcpy (ecr->room_name, roomname);
+      strncpy (ecr->room_name, roomname, sizeof(ecr->room_name));
       free(roomname);
       
       ecr->fellows = NULL;
@@ -1987,7 +1989,7 @@
         eb_debug(DBG_MSN, "Still cannot find sender: %s, calling 
add_unknown\n", username);
         ea = (eb_account *)malloc(sizeof(eb_account));
         mad = g_new0(eb_msn_account_data, 1);
-        strcpy(ea->handle, username);
+        strncpy(ea->handle, username, sizeof(ea->handle));
         ea->service_id = SERVICE_INFO.protocol_id;
         mad->status = MSN_ONLINE;
         ea->protocol_account_data = mad;
@@ -2036,7 +2038,7 @@
 {
   char dialog_message[1025];
   char *tmp = Utf8ToStr(friendlyname);
-  sprintf(dialog_message, _("The MSN user %s (%s) would like to send you this 
file:\n\n   %s (%lu bytes).\n\nDo you want to accept this file ?"),
+  snprintf(dialog_message, sizeof(dialog_message), _("The MSN user %s (%s) 
would like to send you this file:\n\n   %s (%lu bytes).\n\nDo you want to 
accept this file ?"),
          tmp, from, inv->filename, inv->filesize);
   free(tmp);
   eb_debug(DBG_MSN, "got invitation : inv->filename:%s, inv->filesize:%lu\n",
@@ -2095,7 +2097,7 @@
 {
   char dialog_message[1025];
   char *tmp = Utf8ToStr(friendlyname);
-  sprintf(dialog_message, _("The MSN user %s (%s) would like to speak with you 
using (Gnome|Net)Meeting.\n\nDo you want to accept ?"),
+  snprintf(dialog_message, sizeof(dialog_message), _("The MSN user %s (%s) 
would like to speak with you using (Gnome|Net)Meeting.\n\nDo you want to accept 
?"),
          tmp, from);
   free(tmp);
   eb_debug(DBG_MSN, "got netmeeting invitation\n");





reply via email to

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