[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Ayttm-commits] CVS: ayttm/modules/msn2/libmsn2 msn_bittybits.C,1.11,1.1
From: |
Colin Leroy <address@hidden> |
Subject: |
[Ayttm-commits] CVS: ayttm/modules/msn2/libmsn2 msn_bittybits.C,1.11,1.12 msn_core.C,1.45,1.46 |
Date: |
Tue, 25 Mar 2003 17:39:52 -0500 |
Update of /cvsroot/ayttm/ayttm/modules/msn2/libmsn2
In directory subversions:/tmp/cvs-serv856/libmsn2
Modified Files:
msn_bittybits.C msn_core.C
Log Message:
sprintf => snprintf
strcpy => strncpy
Index: msn_bittybits.C
===================================================================
RCS file: /cvsroot/ayttm/ayttm/modules/msn2/libmsn2/msn_bittybits.C,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- msn_bittybits.C 25 Mar 2003 13:08:35 -0000 1.11
+++ msn_bittybits.C 25 Mar 2003 22:39:50 -0000 1.12
@@ -96,7 +96,7 @@
retval=new char * [numspaces];
retval[0]=new char[strlen(buf)+1];
- strcpy(retval[0], buf);
+ strcpy(retval[0], buf); /* long enough */
*numargs=numspaces;
// OK, take it as read (boom, boom!)
@@ -309,7 +309,7 @@
{ *wptr='\0'; break; }
if(!(isalpha(*rptr) || isdigit(*rptr)))
{
- sprintf(wptr, "%%%2x", (int)(*rptr));
+ sprintf(wptr, "%%%2x", (int)(*rptr)); /* this one is ok */
rptr++;
wptr+=3;
Index: msn_core.C
===================================================================
RCS file: /cvsroot/ayttm/ayttm/modules/msn2/libmsn2/msn_core.C,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- msn_core.C 23 Mar 2003 16:09:20 -0000 1.45
+++ msn_core.C 25 Mar 2003 22:39:50 -0000 1.46
@@ -124,7 +124,7 @@
void msn_invite_user(msnconn * conn, char * rcpt)
{
- sprintf(buf, "CAL %d %s\r\n", next_trid++, rcpt);
+ snprintf(buf, sizeof(buf), "CAL %d %s\r\n", next_trid++, rcpt);
write(conn->sock, buf, strlen(buf));
}
@@ -179,24 +179,24 @@
{
if(msg->font==NULL)
{
- sprintf(header, "MIME-Version: 1.0\r\nContent-Type: %s\r\n\r\n",
(msg->content==NULL)?("text/plain; charset=UTF-8"):(msg->content));
+ snprintf(header, sizeof(header), "MIME-Version: 1.0\r\nContent-Type:
%s\r\n\r\n", (msg->content==NULL)?("text/plain; charset=UTF-8"):(msg->content));
} else {
char * fontname=msn_encode_URL(msg->font);
char ef[2] = {'\0', '\0'};
if(msg->bold) { ef[0]='B'; }
if(msg->underline) { ef[0]='U'; }
- sprintf(header, "MIME-Version: 1.0\r\nContent-Type:
%s\r\nX-MMS-IM-Format: FN=%s; EF=%s; CO=%s; CS=0; PF=%d\r\n\r\n",
+ snprintf(header, sizeof(header), "MIME-Version: 1.0\r\nContent-Type:
%s\r\nX-MMS-IM-Format: FN=%s; EF=%s; CO=%s; CS=0; PF=%d\r\n\r\n",
(msg->content==NULL)?("text/plain"):(msg->content), fontname, ef,
msg->colour, msg->fontsize);
delete fontname;
}
} else {
- strcpy(header, msg->header);
+ strncpy(header, msg->header, sizeof(header));
}
- sprintf(buf, "MSG %d N %d\r\n%s", next_trid,
strlen(header)+strlen(msg->body), header);
+ snprintf(buf, sizeof(buf), "MSG %d N %d\r\n%s", next_trid,
strlen(header)+strlen(msg->body), header);
write(conn->sock, buf, strlen(buf));
write(conn->sock, msg->body, strlen(msg->body));
next_trid++;
@@ -212,7 +212,7 @@
else
return;
- sprintf(buf, "MSG %d U %d\r\n%s%s\r\n\r\n\r\n",
+ snprintf(buf, sizeof(buf), "MSG %d U %d\r\n%s%s\r\n\r\n\r\n",
next_trid++, strlen(header)+strlen(username)+6, header, username);
write(conn->sock, buf, strlen(buf));
@@ -220,7 +220,7 @@
void msn_add_to_list(msnconn * conn, char * list, char * username)
{
- sprintf(buf, "ADD %d %s %s %s\r\n", next_trid++, list, username, username);
+ snprintf(buf, sizeof(buf), "ADD %d %s %s %s\r\n", next_trid++, list,
username, username);
if(DEBUG)
printf("%s\n",buf);
@@ -229,7 +229,7 @@
void msn_del_from_list(msnconn * conn, char * list, char * username)
{
- sprintf(buf, "REM %d %s %s\r\n", next_trid++, list, username);
+ snprintf(buf, sizeof(buf), "REM %d %s %s\r\n", next_trid++, list, username);
if(DEBUG)
printf("%s\n",buf);
@@ -238,13 +238,13 @@
void msn_set_GTC(msnconn * conn, char c)
{
- sprintf(buf, "GTC %d %c\r\n", next_trid++, c);
+ snprintf(buf, sizeof(buf), "GTC %d %c\r\n", next_trid++, c);
write(conn->sock, buf, strlen(buf));
}
void msn_set_BLP(msnconn * conn, char c)
{
- sprintf(buf, "BLP %d %cL\r\n", next_trid++, c);
+ snprintf(buf, sizeof(buf), "BLP %d %cL\r\n", next_trid++, c);
write(conn->sock, buf, strlen(buf));
}
@@ -254,7 +254,7 @@
int res;
username=((authdata_NS *)conn->auth)->username;
- sprintf(buf, "REA %d %s %s\r\n", next_trid++, username,
msn_encode_URL(friendlyname));
+ snprintf(buf, sizeof(buf), "REA %d %s %s\r\n", next_trid++, username,
msn_encode_URL(friendlyname));
res = write(conn->sock, buf, strlen(buf));
return (res);
@@ -266,7 +266,7 @@
ext_syncing_lists(1);
info->serial=version;
- sprintf(buf, "SYN %d %d\r\n", next_trid, version);
+ snprintf(buf, sizeof(buf), "SYN %d %d\r\n", next_trid, version);
write(conn->sock, buf, strlen(buf));
msn_add_callback(conn, msn_syncdata, next_trid, info);
@@ -495,7 +495,7 @@
info->auth->tag=tag;
- sprintf(buf, "XFR %d SB\r\n", next_trid);
+ snprintf(buf, sizeof(buf), "XFR %d SB\r\n", next_trid);
write(nsconn->sock, buf, strlen(buf));
msn_add_callback(nsconn, msn_SBconn_2, next_trid, info);
@@ -558,7 +558,7 @@
{
ext_got_SB(conn, auth->tag);
} else {
- sprintf(buf, "CAL %d %s\r\n", next_trid, auth->rcpt);
+ snprintf(buf, sizeof(buf), "CAL %d %s\r\n", next_trid, auth->rcpt);
write(conn->sock, buf, strlen(buf));
delete auth->rcpt;
@@ -1112,7 +1112,7 @@
msnconn * conn=new msnconn;
conn->type=CONN_FTP;
- sprintf(buf, "Connecting to %s:%d\n", remote, port);
+ snprintf(buf, sizeof(buf), "Connecting to %s:%d\n", remote, port);
ext_filetrans_progress(inv, buf, 0, 0);
conn->sock=ext_connect_socket(remote, port);
@@ -1199,7 +1199,7 @@
if(!strcmp(args[0], "VER"))
{
- sprintf(buf, "USR %s %s\r\n", auth->username, auth->cookie);
+ snprintf(buf, sizeof(buf), "USR %s %s\r\n", auth->username,
auth->cookie);
write(conn->sock, buf, strlen(buf));
ext_filetrans_progress(auth->inv, "Negotiating", 0, 0);
} else if (!strcmp(args[0], "FIL")) {
@@ -1332,7 +1332,7 @@
if(!strcmp(args[0], "VER"))
{
- sprintf(buf, "VER MSNFTP\r\n");
+ snprintf(buf, sizeof(buf), "VER MSNFTP\r\n");
write(conn->sock, buf, strlen(buf));
ext_filetrans_progress(auth->inv, "Negotiating", 0, 0);
}
@@ -1348,7 +1348,7 @@
return;
}
- sprintf(buf, "FIL %lu\r\n", auth->inv->filesize);
+ snprintf(buf, sizeof(buf), "FIL %lu\r\n", auth->inv->filesize);
write(conn->sock, buf, strlen(buf));
}
@@ -1502,7 +1502,7 @@
msg->content=msn_permstring("text/x-msmsgsinvite; charset=UTF-8");
- sprintf(buf, "Invitation-Command: ACCEPT\r\n"
+ snprintf(buf, sizeof(buf), "Invitation-Command: ACCEPT\r\n"
"Invitation-Cookie: %s\r\n"
"IP-Address: %s\r\n"
"Port: %d\r\n"
@@ -1678,12 +1678,12 @@
md5_append(&state, (md5_byte_t *)"Q1P7W2E4J9R8U3S5", 16);
md5_finish(&state, digest);
- sprintf(buf, "QRY %d address@hidden 32\r\n", next_trid++);
+ snprintf(buf, sizeof(buf), "QRY %d address@hidden 32\r\n", next_trid++);
write(conn->sock, buf, strlen(buf));
for(a=0; a<16; a++)
{
- sprintf(buf, "%02x", digest[a]);
+ snprintf(buf, sizeof(buf), "%02x", digest[a]);
write(conn->sock, buf, strlen(buf));
}
}
@@ -1708,7 +1708,7 @@
{
message * msg=new message;
- sprintf(buf, "Invitation-Command: CANCEL\r\n"
+ snprintf(buf, sizeof(buf), "Invitation-Command: CANCEL\r\n"
"Invitation-Cookie: %s\r\n"
"Cancel-Code: REJECT\r\n",
inv->cookie);
@@ -1729,7 +1729,7 @@
delete inv->filename;
inv->filename=msn_permstring(dest);
- sprintf(buf, "Invitation-Command: ACCEPT\r\n"
+ snprintf(buf, sizeof(buf), "Invitation-Command: ACCEPT\r\n"
"Invitation-Cookie: %s\r\n"
"Launch-Application: FALSE\r\n"
"Request-Data: IP-Address\r\n\r\n",
@@ -1747,7 +1747,7 @@
{
message * msg=new message;
- sprintf(buf, "Invitation-Command: CANCEL\r\n"
+ snprintf(buf, sizeof(buf), "Invitation-Command: CANCEL\r\n"
"Invitation-Cookie: %s\r\n"
"Cancel-Code: REJECT\r\n",
inv->cookie);
@@ -1768,7 +1768,7 @@
if (inv->app == APP_NETMEETING) {
if(DEBUG) printf("ACCEPTING NETMEETING\n");
- sprintf(buf, "Invitation-Command: ACCEPT\r\n"
+ snprintf(buf, sizeof(buf), "Invitation-Command: ACCEPT\r\n"
"Invitation-Cookie: %s\r\n"
"Launch-Application: TRUE\r\n"
"Session-ID: %s\r\n"
@@ -1780,7 +1780,7 @@
ext_get_IP());
} else { /* SIP voice ... will be supported one day or another */
if (DEBUG) printf("ACCEPTING VOICE\n");
- sprintf(buf, "Invitation-Command: ACCEPT\r\n"
+ snprintf(buf, sizeof(buf), "Invitation-Command: ACCEPT\r\n"
"Invitation-Cookie: %s\r\n"
"Launch-Application: FALSE\r\n"
"Session-ID: %s\r\n"
@@ -1835,7 +1835,7 @@
msg->content=msn_permstring("text/x-msmsgsinvite; charset=UTF-8");
- sprintf(buf, "Application-Name: File transfer\r\n"
+ snprintf(buf, sizeof(buf), "Application-Name: File transfer\r\n"
"Application-GUID: {5D3E02AB-6190-11d3-BBBB-00C04F795683}\r\n"
"Invitation-Command: INVITE\r\n"
"Invitation-Cookie: %s\r\n"
@@ -1871,12 +1871,12 @@
if(auth->sessionID==NULL)
{
- sprintf(buf, "USR %d %s %s\r\n", next_trid, auth->username,
auth->cookie);
+ snprintf(buf, sizeof(buf), "USR %d %s %s\r\n", next_trid,
auth->username, auth->cookie);
write(conn->sock, buf, strlen(buf));
msn_add_callback(conn, msn_SBconn_3, next_trid, NULL);
} else {
- sprintf(buf, "ANS %d %s %s %s\r\n", next_trid, auth->username,
auth->cookie, auth->sessionID);
+ snprintf(buf, sizeof(buf), "ANS %d %s %s %s\r\n", next_trid,
auth->username, auth->cookie, auth->sessionID);
write(conn->sock, buf, strlen(buf));
ext_new_connection(conn);
@@ -1913,7 +1913,7 @@
printf("Connected\n"); // DEBUG
- sprintf(buf, "VER %d MSNP7\r\n", next_trid);
+ snprintf(buf, sizeof(buf), "VER %d MSNP7\r\n", next_trid);
write(conn->sock, buf, strlen(buf));
msn_add_callback(conn, msn_connect_2, next_trid, (callback_data *)info);
next_trid++;
@@ -1964,7 +1964,7 @@
return;
}
- sprintf(buf, "USR %d MD5 I %s\r\n", next_trid, info->username);
+ snprintf(buf, sizeof(buf), "USR %d MD5 I %s\r\n", next_trid, info->username);
write(conn->sock, buf, strlen(buf));
msn_add_callback(conn, msn_connect_3, next_trid, data);
@@ -1997,12 +1997,12 @@
md5_append(&state, (md5_byte_t *)(info->password), strlen(info->password));
md5_finish(&state, digest);
- sprintf(buf, "USR %d MD5 S ", next_trid);
+ snprintf(buf, sizeof(buf), "USR %d MD5 S ", next_trid);
write(conn->sock, buf, strlen(buf));
for(a=0; a<16; a++)
{
- sprintf(buf, "%02x", digest[a]);
+ snprintf(buf, sizeof(buf), "%02x", digest[a]);
write(conn->sock, buf, 2);
}
@@ -2064,7 +2064,7 @@
void msn_set_state(msnconn * conn, char * state)
{
- sprintf(buf, "CHG %d %s\r\n", next_trid, state);
+ snprintf(buf, sizeof(buf), "CHG %d %s\r\n", next_trid, state);
write(conn->sock, buf, strlen(buf));
next_trid++;
}
@@ -2077,7 +2077,7 @@
return;
}
- sprintf(buf, "ADG %d %s 0\r\n", next_trid, msn_encode_URL(newgroup));
+ snprintf(buf, sizeof(buf), "ADG %d %s 0\r\n", next_trid,
msn_encode_URL(newgroup));
write(conn->sock, buf, strlen(buf));
next_trid++;
}
@@ -2089,11 +2089,11 @@
return;
}
- sprintf(buf, "ADD %d FL %s %s %s\r\n", next_trid, handle, handle,
newgroup);
+ snprintf(buf, sizeof(buf), "ADD %d FL %s %s %s\r\n", next_trid, handle,
handle, newgroup);
write(conn->sock, buf, strlen(buf));
next_trid++;
if (oldgroup != NULL) {
- sprintf(buf, "REM %d FL %s %s\r\n", next_trid, handle,
oldgroup);
+ snprintf(buf, sizeof(buf), "REM %d FL %s %s\r\n", next_trid,
handle, oldgroup);
write(conn->sock, buf, strlen(buf));
next_trid++;
}
@@ -2106,7 +2106,7 @@
return;
}
- sprintf(buf, "RMG %d %s\r\n", next_trid, group_id);
+ snprintf(buf, sizeof(buf), "RMG %d %s\r\n", next_trid, group_id);
write(conn->sock, buf, strlen(buf));
next_trid++;
if (DEBUG)
@@ -2121,7 +2121,7 @@
return;
}
- sprintf(buf, "REG %d %s %s 0\r\n", next_trid, id,
msn_encode_URL(newname));
+ snprintf(buf, sizeof(buf), "REG %d %s %s 0\r\n", next_trid, id,
msn_encode_URL(newname));
write(conn->sock, buf, strlen(buf));
next_trid++;
}
@@ -2143,7 +2143,7 @@
message * msg = new message;
msg->content=msn_permstring("text/x-msmsgsinvite; charset=UTF-8");
- sprintf(buf, "Application-Name: NetMeeting\r\n"
+ snprintf(buf, sizeof(buf), "Application-Name: NetMeeting\r\n"
"Application-GUID: {44BBA842-CC51-11CF-AAFA-00AA00B6015C}\r\n"
"Session-Protocol: SM1\r\n"
"Invitation-Command: INVITE\r\n"
@@ -2169,7 +2169,7 @@
message * msg = new message;
msg->content=msn_permstring("text/x-msmsgsinvite; charset=UTF-8");
- sprintf(buf, "Invitation-Command: ACCEPT\r\n"
+ snprintf(buf, sizeof(buf), "Invitation-Command: ACCEPT\r\n"
"Invitation-Cookie: %s\r\n"
"Session-ID: %s\r\n"
"Launch-Application: TRUE\r\n"
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Ayttm-commits] CVS: ayttm/modules/msn2/libmsn2 msn_bittybits.C,1.11,1.12 msn_core.C,1.45,1.46,
Colin Leroy <address@hidden> <=
- Prev by Date:
[Ayttm-commits] CVS: ayttm/src input_list.c,1.10,1.11 trigger.c,1.12,1.13
- Next by Date:
[Ayttm-commits] CVS: ayttm/modules/msn2 msn.C,1.91,1.92
- Previous by thread:
[Ayttm-commits] CVS: ayttm/src input_list.c,1.10,1.11 trigger.c,1.12,1.13
- Next by thread:
[Ayttm-commits] CVS: ayttm/modules/msn2 msn.C,1.91,1.92
- Index(es):