Ensure not to overflow buf in udp server example

PUBLISHED_FROM=413f5073b0fc267d66ce04d8d40e9e9d7abac94d
This commit is contained in:
Dmitry Frank 2018-01-30 15:12:49 +02:00 committed by Cesanta Bot
parent e116c48bef
commit e5b3b8ad32

View File

@ -79,7 +79,7 @@ int main(int argc, char **argv) {
mg_mgr_init(&mgr, NULL);
{
char listen[256];
sprintf(listen, "udp://%s", port);
snprintf(listen, sizeof(listen), "udp://%s", port);
nc = mg_bind(&mgr, listen, ev_handler);
}