|
|
@@ -202,6 +202,18 @@ int vcc_message_broadcast(char *msg, char *usrname) {
|
|
|
int vcc_new_msg(int fd, struct vcc_request *req) {
|
|
|
char *msg = req->msg;
|
|
|
|
|
|
+ if (unlikely(ntohl(req->magic) != VCC_MAGIC)) {
|
|
|
+ vcc_log("--- bad magic number from %d\n", fd);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (unlikely(htonl(req->reqtype) != REQ_MSG_SEND)) {
|
|
|
+ vcc_log("--- request's type is not REQ_MSG_SEND from %d\n", fd);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
if (((unsigned char *) msg)[0] == 0xffu || !*msg)
|
|
|
return 0;
|
|
|
|