|
@@ -55,8 +55,8 @@ int send_msg(const char *msg, const char *usrname) {
|
|
|
req.reqtype = htonl(REQ_MSG_SEND);
|
|
req.reqtype = htonl(REQ_MSG_SEND);
|
|
|
req.uid = 0;
|
|
req.uid = 0;
|
|
|
|
|
|
|
|
- strcpy(req.usrname, usrname);
|
|
|
|
|
- strcpy(req.msg, msg);
|
|
|
|
|
|
|
+ strncpy(req.usrname, usrname, USRNAME_SIZE);
|
|
|
|
|
+ strncpy(req.msg, msg, MSG_SIZE);
|
|
|
write(fd, &req, REQ_SIZE);
|
|
write(fd, &req, REQ_SIZE);
|
|
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
@@ -128,8 +128,8 @@ int vcc_login(char *usrname, char *passwd) {
|
|
|
req.magic = htonl(VCC_MAGIC);
|
|
req.magic = htonl(VCC_MAGIC);
|
|
|
req.reqtype = htonl(REQ_CTL_LOGIN);
|
|
req.reqtype = htonl(REQ_CTL_LOGIN);
|
|
|
|
|
|
|
|
- strcpy(req.usrname, usrname);
|
|
|
|
|
- strcpy(req.msg, passwd);
|
|
|
|
|
|
|
+ strncpy(req.usrname, usrname, USRNAME_SIZE);
|
|
|
|
|
+ strncpy(req.msg, passwd, MSG_SIZE);
|
|
|
|
|
|
|
|
write(fd, &req, REQ_SIZE);
|
|
write(fd, &req, REQ_SIZE);
|
|
|
|
|
|