Skip to content

Commit

Permalink
Fixed segfault due to reading incorrect input
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardalee committed Jun 27, 2024
1 parent c723baa commit d6d2057
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/C/src/lib/WebSocketServerString.lf
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ reactor WebSocketServerString(hostport: int = 8080, initial_file: string = {= NU
if (in_dynamic->is_present) {
message_copy = (char*)malloc(strlen(in_dynamic->value));
strcpy(message_copy, in_dynamic->value);
to_send->length = strlen(in_dynamic->value);
} else {
message_copy = (char*)malloc(strlen(in_static->value));
strcpy(message_copy, in_static->value);
to_send->length = strlen(in_static->value);
}
to_send->message = message_copy;
to_send->length = strlen(in_dynamic->value);
to_send->wsi = self->ws.wsi;

lf_set(server.send, to_send);
} else {
// Web socket is not connected.
Expand Down

0 comments on commit d6d2057

Please sign in to comment.