ayttm-commits
[Top][All Lists]
Advanced

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

[Ayttm-commits] CVS: ayttm/src account.c,1.17,1.18 account_parser.y,1.6


From: Colin Leroy <address@hidden>
Subject: [Ayttm-commits] CVS: ayttm/src account.c,1.17,1.18 account_parser.y,1.6,1.7 chat_room.c,1.58,1.59 chat_window.c,1.65,1.66 contact_actions.c,1.8,1.9 contact_parser.y,1.10,1.11 log_window.c,1.22,1.23 main.c,1.26,1.27 offline_queue_mgmt.c,1.12,1.13 prefs.c,1.31,1.32 prefs_window.c,1.11,1.12 smileys.c,1.18,1.19 speech.c,1.5,1.6 trigger.c,1.13,1.14 util.c,1.61,1.62
Date: Tue, 25 Mar 2003 18:05:01 -0500

Update of /cvsroot/ayttm/ayttm/src
In directory subversions:/tmp/cvs-serv4072/src

Modified Files:
        account.c account_parser.y chat_room.c chat_window.c 
        contact_actions.c contact_parser.y log_window.c main.c 
        offline_queue_mgmt.c prefs.c prefs_window.c smileys.c speech.c 
        trigger.c util.c 
Log Message:
strcpy => strncpy


Index: account.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/account.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- account.c   23 Mar 2003 23:48:15 -0000      1.17
+++ account.c   25 Mar 2003 23:04:58 -0000      1.18
@@ -198,8 +198,9 @@
        dum->account_contact = g_new0(struct contact, 1);
        dum->account_contact->group = g_new0(grouplist, 1);
        
-       strcpy(dum->handle, handle);
-       strcpy(dum->account_contact->group->name, group);
+       strncpy(dum->handle, handle, sizeof(dum->handle));
+       strncpy(dum->account_contact->group->name, group,
+               sizeof(dum->account_contact->group->name));
        dum->service_id = serviceid;
        
        return dum;

Index: account_parser.y
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/account_parser.y,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- account_parser.y    27 Jan 2003 16:12:41 -0000      1.6
+++ account_parser.y    25 Mar 2003 23:04:58 -0000      1.7
@@ -89,8 +89,8 @@
                        {
                                value_pair * vp = g_new0( value_pair, 1 );
                                char * value = unescape_string($3);
-                               strcpy( vp->key, $1 );
-                               strcpy( vp->value, value);
+                               strncpy( vp->key, $1 , sizeof(vp->key));
+                               strncpy( vp->value, value, sizeof(vp->value));
 
                                free($1);
                                free($3);

Index: chat_room.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/chat_room.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- chat_room.c 24 Mar 2003 22:42:41 -0000      1.58
+++ chat_room.c 25 Mar 2003 23:04:58 -0000      1.59
@@ -622,8 +622,8 @@
         gchar *buf;
        LList *t;
        ecrb = g_new0(eb_chat_room_buddy, 1 );
-       strcpy( ecrb->alias, alias);
-       strcpy( ecrb->handle, handle );
+       strncpy( ecrb->alias, alias, sizeof(ecrb->alias));
+       strncpy( ecrb->handle, handle, sizeof(ecrb->handle));
        room->total_arrivals++;
        ecrb->color = room->total_arrivals % nb_cr_colors;
        

Index: chat_window.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/chat_window.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -r1.65 -r1.66
--- chat_window.c       25 Mar 2003 22:06:12 -0000      1.65
+++ chat_window.c       25 Mar 2003 23:04:59 -0000      1.66
@@ -129,7 +129,8 @@
                                if( iconv(conv_desc, &ptr_src_text, &inleft, 
&ptr_recoded_text, &outleft) == (size_t)(-1) ){
                                        if( inleft && errno == EILSEQ ) {
                                                if( tries == 3 ) {
-                                                       strcpy( 
ptr_recoded_text, ptr_src_text );
+                                                       strncpy( 
ptr_recoded_text, ptr_src_text,
+                                                               
strlen(source_text)*2 );
                                                        fprintf( stderr, 
"Ayttm: recoding broke 3 times,"
                                                           " leaving the rest 
of the line as it is...\n");
                                                        break;
@@ -1485,7 +1486,7 @@
                } else {
                        int has_space = 0, i=0;
                        strip_html(buff); /*better safe than sorry */
-                       strcpy(buff2, buff);
+                       strncpy(buff2, buff, sizeof(buff2));
 
                        token = strtok(buff2,":");
                        while (token && token[i]) {
@@ -1728,7 +1729,7 @@
                        buff[17]='\0';
                        strcat(buff, "..."); /* buff is large enough */
                } else
-                       strcpy(buff, remote->nick);
+                       strncpy(buff, remote->nick, sizeof(buff));
 
                /* set up the text and close button */
                contact_label = gtk_label_new(buff);

Index: contact_actions.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/contact_actions.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- contact_actions.c   29 Jan 2003 19:19:22 -0000      1.8
+++ contact_actions.c   25 Mar 2003 23:04:59 -0000      1.9
@@ -50,7 +50,7 @@
                RUN_SERVICE(ela)->send_file(ela, x_fer_account, 
selected_filename);
        } else {
                eb_local_account * ela = find_suitable_local_account(NULL, 
ea->service_id);
-               strcpy(filename, selected_filename);
+               strncpy(filename, selected_filename, sizeof(filename));
                RUN_SERVICE(ela)->send_im(ela, ea, "EB_COMMAND SEND_FILE");
        }
 }

Index: contact_parser.y
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/contact_parser.y,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- contact_parser.y    3 Mar 2003 18:52:11 -0000       1.10
+++ contact_parser.y    25 Mar 2003 23:04:59 -0000      1.11
@@ -56,7 +56,7 @@
                char * c;
                cur_group = g_new0(grouplist, 1);
                c = value_pair_get_value( $2, "NAME" );
-               strcpy( cur_group->name, c );
+               strncpy( cur_group->name, c , sizeof(cur_group->name));
                g_free(c);
                cur_group->tree = NULL;
                value_pair_free($2);
@@ -76,7 +76,7 @@
                char * c;
                cur_contact = g_new0( struct contact, 1 );
                c = value_pair_get_value( $2, "NAME" );
-               strcpy( cur_contact->nick, c );
+               strncpy( cur_contact->nick, c , sizeof(cur_contact->nick));
                g_free(c);
                c = value_pair_get_value( $2, "TRIGGER_TYPE" );
                cur_contact->trigger.type = get_trigger_type_num(c);
@@ -156,8 +156,8 @@
                        {
                                char * tmp = escape_string ($3);
                                value_pair * vp = g_new0( value_pair, 1 );
-                               strcpy( vp->key, $1 );
-                               strcpy( vp->value, tmp );
+                               strncpy( vp->key, $1 , sizeof(vp->key));
+                               strncpy( vp->value, tmp, sizeof(vp->value) );
                                free(tmp);
                                free($1);
                                free($3);

Index: log_window.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/log_window.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- log_window.c        25 Mar 2003 22:06:13 -0000      1.22
+++ log_window.c        25 Mar 2003 23:04:59 -0000      1.23
@@ -123,7 +123,7 @@
   if (lw->remote)
          make_safe_filename(name_buffer, lw->remote->nick, 
lw->remote->group->name);
   else if (lw->filename)
-         strcpy(name_buffer, lw->filename);
+         strncpy(name_buffer, lw->filename, sizeof(name_buffer));
   else
          return;
                                
@@ -167,7 +167,7 @@
                          char buff1[4096];
                          p3[0] = _("Undated Log");
 
-                               strcpy(buff1, read_buffer);
+                               strncpy(buff1, read_buffer, sizeof(buff1));
                                idx = 
gtk_clist_append(GTK_CLIST(lw->date_list), p3);
 
                                /* add new gslist entry */

Index: main.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/main.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- main.c      25 Mar 2003 21:54:13 -0000      1.26
+++ main.c      25 Mar 2003 23:04:59 -0000      1.27
@@ -312,7 +312,7 @@
                        break;
 
                    case 'g':
-                       strcpy(geometry, optarg);
+                       strncpy(geometry, optarg, sizeof(geometry));
                        break;
 
                    case ':':
@@ -329,11 +329,11 @@
                        break;
 
                    case 'c':
-                       strcpy(contact, optarg);
+                       strncpy(contact, optarg, sizeof(contact));
                        break;
 
                    case 'm':
-                       strcpy(message, optarg);
+                       strncpy(message, optarg, sizeof(message));
                        break;
 
 #ifdef CRASH_DIALOG
@@ -343,7 +343,7 @@
                        break;
 #endif                 
                    case 'd':
-                       strcpy(config_dir, optarg);
+                       strncpy(config_dir, optarg, sizeof(config_dir));
                        /*Make sure we have directory delimiter */
 #if defined( _WIN32 )
                        if (config_dir[strlen(config_dir)-1]!='\\')
@@ -392,8 +392,9 @@
 
 #ifndef __MINGW32__
                sock = socket(AF_UNIX, SOCK_STREAM, 0);
-               strcpy(remote.sun_path, config_dir);
-               strcat(remote.sun_path, "eb_socket");
+               strncpy(remote.sun_path, config_dir, sizeof(remote.sun_path));
+               strncat(remote.sun_path, "eb_socket",
+                       sizeof(remote.sun_path)-strlen(remote.sun_path));
                remote.sun_family = AF_UNIX;
                len = strlen(remote.sun_path) + sizeof(remote.sun_family) +1;
 #else
@@ -433,8 +434,9 @@
                int ret;
 #ifndef __MINGW32__
                sock = socket(AF_UNIX, SOCK_STREAM, 0);
-               strcpy(remote.sun_path, config_dir);
-               strcat(remote.sun_path, "eb_socket");
+               strncpy(remote.sun_path, config_dir, sizeof(remote.sun_path));
+               strncat(remote.sun_path, "eb_socket",
+                       sizeof(remote.sun_path)-strlen(remote.sun_path));
                remote.sun_family = AF_UNIX;
                len = strlen(remote.sun_path) + sizeof(remote.sun_family) +1;
 #else
@@ -465,8 +467,9 @@
        if (!disable_console_server) {
 #ifndef __MINGW32__
                sock = socket(AF_UNIX, SOCK_STREAM, 0);
-               strcpy(local.sun_path, config_dir);
-               strcat(local.sun_path, "eb_socket");
+               strncpy(local.sun_path, config_dir, sizeof(local.sun_path));
+               strncat(local.sun_path, "eb_socket",
+                       sizeof(local.sun_path)-strlen(local.sun_path));
                unlink(local.sun_path);
                local.sun_family = AF_UNIX;
                len = strlen(local.sun_path) + sizeof(local.sun_family) +1;

Index: offline_queue_mgmt.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/offline_queue_mgmt.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- offline_queue_mgmt.c        25 Mar 2003 13:40:53 -0000      1.12
+++ offline_queue_mgmt.c        25 Mar 2003 23:04:59 -0000      1.13
@@ -130,7 +130,7 @@
        while( fgets(buff, sizeof(buff), queue)  != NULL )
        {               
                char buff_backup[NAME_MAX];
-               strcpy(buff_backup, buff);
+               strncpy(buff_backup, buff, NAME_MAX);
                tokens = ay_strsplit( buff, "\t", -1 );
                if(!strcmp(tokens[0],get_service_name(ela->service_id))) {
                        int action     = atoi(tokens[1]);
@@ -154,15 +154,17 @@
                        if (ea && action == MGMT_MOV) {
                                char realgrp[NAME_MAX];
                                /* this is "a bit" ugly :-( */
-                               
strcpy(realgrp,ea->account_contact->group->name);
-                               
strcpy(ea->account_contact->group->name,oldgroup);
+                               
strncpy(realgrp,ea->account_contact->group->name, sizeof(realgrp));
+                               
strncpy(ea->account_contact->group->name,oldgroup, 
+                                       
sizeof(ea->account_contact->group->name));
                                if (!strcmp(newgroup, _("Ignore")) && CAN(ea, 
ignore_user))
                                        RUN_SERVICE(ea)->ignore_user(ea);
                                else if (!strcmp(oldgroup, _("Ignore")) && 
CAN(ea, unignore_user))
                                        RUN_SERVICE(ea)->unignore_user(ea, 
newgroup);
                                else if (CAN(ea, change_group))
                                        RUN_SERVICE(ea)->change_group(ea, 
newgroup);
-                               strcpy(ea->account_contact->group->name, 
realgrp);
+                               strncpy(ea->account_contact->group->name, 
realgrp,
+                                       
sizeof(ea->account_contact->group->name));
                        }
                        
                        if (ea && action == MGMT_REN && CAN(ea, 
change_user_name)) {
@@ -258,7 +260,7 @@
        while( fgets(buff, sizeof(buff), queue)  != NULL )
        {               
                char buff_backup[NAME_MAX];
-               strcpy(buff_backup, buff);
+               strncpy(buff_backup, buff, NAME_MAX);
                tokens = ay_strsplit( buff, "\t", -1 );
                if(!strcmp(tokens[0], get_service_name(ela->service_id))) {
                        int action     = atoi(tokens[1]);

Index: prefs.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/prefs.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- prefs.c     22 Mar 2003 11:48:25 -0000      1.31
+++ prefs.c     25 Mar 2003 23:04:59 -0000      1.32
@@ -54,7 +54,7 @@
 {
        ptr_list *PrefData = g_new0(ptr_list, 1);
        
-       strcpy(PrefData->key, key);
+       strncpy(PrefData->key, key, sizeof(PrefData->key));
        PrefData->value=(void *)data;
        s_global_prefs = g_list_append(s_global_prefs, PrefData);
        return;

Index: prefs_window.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/prefs_window.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- prefs_window.c      25 Mar 2003 21:54:13 -0000      1.11
+++ prefs_window.c      25 Mar 2003 23:04:59 -0000      1.12
@@ -1838,12 +1838,12 @@
      do_play_send_old = do_play_send;
      do_play_first_old = do_play_first;
      do_play_receive_old = do_play_receive;
-     strcpy(BuddyArriveFilename_old, cGetLocalPref("BuddyArriveFilename"));
-     strcpy(BuddyAwayFilename_old, cGetLocalPref("BuddyAwayFilename"));
-     strcpy(BuddyLeaveFilename_old, cGetLocalPref("BuddyLeaveFilename"));
-     strcpy(SendFilename_old, cGetLocalPref("SendFilename"));
-     strcpy(ReceiveFilename_old, cGetLocalPref("ReceiveFilename"));
-     strcpy(FirstMsgFilename_old, cGetLocalPref("FirstMsgFilename"));
+     strncpy(BuddyArriveFilename_old, cGetLocalPref("BuddyArriveFilename"), 
1024);
+     strncpy(BuddyAwayFilename_old, cGetLocalPref("BuddyAwayFilename"), 1024);
+     strncpy(BuddyLeaveFilename_old, cGetLocalPref("BuddyLeaveFilename"), 
1024);
+     strncpy(SendFilename_old, cGetLocalPref("SendFilename"), 1024);
+     strncpy(ReceiveFilename_old, cGetLocalPref("ReceiveFilename"), 1024);
+     strncpy(FirstMsgFilename_old, cGetLocalPref("FirstMsgFilename"), 1024);
      volume_sound_old = iGetLocalPref("SoundVolume");
 
      /* General Tab */

Index: smileys.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/smileys.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- smileys.c   4 Mar 2003 15:12:27 -0000       1.18
+++ smileys.c   25 Mar 2003 23:04:59 -0000      1.19
@@ -293,8 +293,8 @@
   protocol_smiley * psmile;
 
   psmile=g_new0(protocol_smiley, 1);
-  strcpy(psmile->text, text);
-  strcpy(psmile->name, name);
+  strncpy(psmile->text, text, sizeof(psmile->text));
+  strncpy(psmile->name, name, sizeof(psmile->name));
   return l_list_append(list, psmile);
 }
 
@@ -303,7 +303,7 @@
   smiley * psmile;
 
   psmile=g_new0(smiley, 1);
-  strcpy(psmile->name, name);
+  strncpy(psmile->name, name, sizeof(psmile->name));
   psmile->pixmap=data;
   return l_list_append(list, psmile);
 }

Index: speech.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/speech.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- speech.c    25 Mar 2003 22:06:13 -0000      1.5
+++ speech.c    25 Mar 2003 23:04:59 -0000      1.6
@@ -42,7 +42,7 @@
 
   if (do_no_sound_when_away && is_away) return;
 
-  strcpy(xbuff, message);
+  strncpy(xbuff, message, sizeof(xbuff));
   strip_html(xbuff);
   // todo: convert "LOL" to "ha ha ha"?
   snprintf(mbuff, sizeof(mbuff), "%s says: ", remote->handle);

Index: trigger.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/trigger.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- trigger.c   25 Mar 2003 22:18:16 -0000      1.13
+++ trigger.c   25 Mar 2003 23:04:59 -0000      1.14
@@ -169,7 +169,8 @@
 
 static void set_button_callback(GtkWidget* widget, struct contact * con)
 {
-  strcpy( con->trigger.param, gtk_entry_get_text(GTK_ENTRY(parameter)));
+  strncpy( con->trigger.param, gtk_entry_get_text(GTK_ENTRY(parameter)),
+               sizeof(con->trigger.param));
   con -> trigger.type = 
g_list_index(GTK_LIST(GTK_COMBO(trigger_list)->list)->children, 
                                     
GTK_LIST(GTK_COMBO(trigger_list)->list)->selection->data);
   con -> trigger.action = 
g_list_index(GTK_LIST(GTK_COMBO(action_name)->list)->children, 

Index: util.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/util.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -r1.61 -r1.62
--- util.c      25 Mar 2003 22:06:13 -0000      1.61
+++ util.c      25 Mar 2003 23:04:59 -0000      1.62
@@ -911,8 +911,8 @@
        LList *node = NULL;
        char oldname[NAME_MAX];
 
-       strcpy (oldname, current_group->name);
-       strcpy (current_group->name, new_name);
+       strncpy (oldname, current_group->name, sizeof(oldname));
+       strncpy (current_group->name, new_name, sizeof(current_group->name));
        gtk_label_set_text(GTK_LABEL(current_group->label),
                                   current_group->name);
        update_contact_list();
@@ -1473,10 +1473,10 @@
        char oldnicklog[255], newnicklog[255], buff[255];
        FILE *test = NULL;
        make_safe_filename(buff, oldnick, oldgroup);
-       strcpy(oldnicklog, buff);
+       strncpy(oldnicklog, buff, 255);
 
        make_safe_filename(buff, newnick, newgroup);
-       strcpy(newnicklog, buff);
+       strncpy(newnicklog, buff, 255);
 
        if (!strcmp(oldnicklog, newnicklog))
                return;





reply via email to

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