secure strscpy by replacing with strncpy

This commit is contained in:
Michael Stapelberg
2011-07-23 22:22:36 +02:00
parent a402480ad0
commit fdd098b010
3 changed files with 3 additions and 3 deletions

View File

@ -77,7 +77,7 @@ static void ipc_send_message(int fd, const unsigned char *payload,
char msg[buffer_size];
char *walk = msg;
strcpy(walk, "i3-ipc");
strncpy(walk, "i3-ipc", buffer_size - 1);
walk += strlen("i3-ipc");
memcpy(walk, &message_size, sizeof(uint32_t));
walk += sizeof(uint32_t);