about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-10-02 00:57:29 +0100
committerJames Booth <boothj5@gmail.com>2014-10-02 00:57:29 +0100
commit92a0aba93fee94f6bacd995ff9345bbaeb901484 (patch)
treeb338bc292adbf04e6c5d7547b39acefa410da622 /src/command
parentded712c35cc70f341c96df7d554e1b8913f7dfbb (diff)
downloadprofani-tty-92a0aba93fee94f6bacd995ff9345bbaeb901484.tar.gz
Removed usages of strcpy
Diffstat (limited to 'src/command')
-rw-r--r--src/command/commands.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/command/commands.c b/src/command/commands.c
index 045ad00a..ed4afa80 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -1104,15 +1104,11 @@ cmd_msg(gchar **args, struct cmd_help_t help)
                     cons_show_error("Failed to send message. Please check OTR policy");
                     return TRUE;
                 } else if (policy == PROF_OTRPOLICY_OPPORTUNISTIC) {
-                    char *otr_base_tag = OTRL_MESSAGE_TAG_BASE;
-                    char *otr_v2_tag = OTRL_MESSAGE_TAG_V2;
-                    int N = strlen(otr_base_tag) + strlen(otr_v2_tag) + strlen(msg) + 1;
-                    char *temp = (char *) malloc( (unsigned) N*sizeof(char *) );
-                    strcpy( temp , msg );
-                    strcat( temp , otr_base_tag);
-                    strcat( temp, otr_v2_tag);
-                    message_send(temp, usr_jid);
-                    free(temp);
+                    GString *otr_message = g_string_new(msg);
+                    g_string_append(otr_message, OTRL_MESSAGE_TAG_BASE);
+                    g_string_append(otr_message, OTRL_MESSAGE_TAG_V2);
+                    message_send(otr_message->str, usr_jid);
+                    g_string_free(otr_message, TRUE);
                 } else {
                     message_send(msg, usr_jid);
                 }
='alt'>
                  








                  
                                        


                                       
 



                                                        
                                            





                                                           
8' href='#n188'>188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230