Skip to content

Commit d85de92

Browse files
committed
Fix wrong size passing in client
1 parent be628be commit d85de92

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

progs/client.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,15 @@ int main(int argc, char *argv[])
5252
char buffer[BUFFER_SIZE];
5353
size_t size;
5454
char *line;
55-
udt_send(sock, "Client want to talk", strlen(buffer) + 1, 0);
55+
strcpy(buffer, "Client wants to talk");
56+
udt_send(sock, buffer, strlen(buffer) + 1, 0);
5657
while (udt_recv(sock, buffer, sizeof(buffer), 0) > 0) {
5758
printf("Recvd: %s\n>> ", buffer);
5859
memset(buffer, 0, sizeof(buffer));
5960

6061
size = 0;
6162
size = getline(&line, &size, stdin);
63+
*(line + size - 1) = '\0';
6264
udt_send(sock, line, size, 0);
6365
free(line);
6466
}

0 commit comments

Comments
 (0)