Skip to content

Commit eb029b9

Browse files
clamattiakartben
authored andcommitted
net: http: server: Avoid compiler warnings for zero-length-arrays
Avoid compiler warnings for zero-length-arrays in the http-server. By using memcpy instead of strcpy. Signed-off-by: Cla Mattia Galliard <cla-mattia.galliard@zuehlke.com>
1 parent f764b21 commit eb029b9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

subsys/net/lib/http/http_server_http1.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ static void check_user_request_headers(struct http_header_capture_ctx *ctx, cons
678678
break;
679679
}
680680

681-
strcpy(dest, header->name);
681+
memcpy(dest, header->name, header_len + 1);
682682

683683
ctx->headers[ctx->count].name = dest;
684684
ctx->cursor += (header_len + 1);
@@ -756,7 +756,7 @@ static void populate_user_request_header(struct http_header_capture_ctx *ctx, co
756756
}
757757

758758
dest = &ctx->buffer[ctx->cursor];
759-
strcpy(dest, buf);
759+
memcpy(dest, buf, value_len + 1);
760760
ctx->cursor += (value_len + 1);
761761

762762
ctx->headers[ctx->count].value = dest;

0 commit comments

Comments
 (0)