Skip to content

Commit

Permalink
is this gonna fuck it up?
Browse files Browse the repository at this point in the history
  • Loading branch information
tgiarrat committed Apr 29, 2017
1 parent d757af0 commit f9c640c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions chat_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,15 +214,15 @@ int newClientConnection(int serverSocket,struct clientNode **head ){
int clientSocket, messageLen;
char handle[MAX_HANDLE_LEN];
uint8_t handleLength;
char buf[MAX_PACKET_SIZE];
char *buf[MAX_PACKET_SIZE];
struct chat_header cheader;

if ((clientSocket = accept(serverSocket,(struct sockaddr*) 0, (socklen_t *) 0)) < 0) {
perror("accept call error");
exit(-1);
}

recievePacket(clientSocket, &((char *)buf));
recievePacket(clientSocket, buf);

/*
//recieve the clients initial packet containing handle and handle length
Expand All @@ -236,8 +236,8 @@ int newClientConnection(int serverSocket,struct clientNode **head ){
exit(-1);
}*/

memcpy(&handleLength, buf + sizeof(struct chat_header), sizeof(uint8_t));
memcpy(handle, buf + sizeof(struct chat_header) + sizeof(uint8_t), handleLength);
memcpy(&handleLength, *buf + sizeof(struct chat_header), sizeof(uint8_t));
memcpy(handle, *buf + sizeof(struct chat_header) + sizeof(uint8_t), handleLength);
handle[handleLength] = '\0';

if (checkHandle(handle, *head) == 1) {
Expand Down
Binary file modified server
Binary file not shown.

0 comments on commit f9c640c

Please sign in to comment.