From 57046d51b37e255353f71765245eda7a68a725f2 Mon Sep 17 00:00:00 2001 From: ruti <> Date: Tue, 14 Jan 2025 14:37:34 +0300 Subject: [PATCH] Print partial UDP packet hex dump --- desync.c | 4 ++++ main.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/desync.c b/desync.c index 407fefe..5a69460 100644 --- a/desync.c +++ b/desync.c @@ -626,6 +626,10 @@ ssize_t desync_udp(int sfd, char *buffer, { struct desync_params *dp = ¶ms.dp[dp_c]; + if (params.debug) { + INIT_HEX_STR(buffer, (n > 16 ? 16 : n)); + LOG(LOG_S, "bytes: %s (%zd)\n", HEX_STR, n); + } if (dp->udp_fake_count != 0) { struct packet pkt; if (dp->fake_data.data) { diff --git a/main.c b/main.c index 56a2155..46dd460 100644 --- a/main.c +++ b/main.c @@ -805,7 +805,7 @@ int main(int argc, char **argv) #else val = strtol(optarg, &end, 0); #endif - if (val <= 0 || val > UINT_MAX || *end) + if (val <= 0 || val > (long)UINT_MAX || *end) invalid = 1; else params.timeout = val;