Skip to content

Commit 268b5e4

Browse files
mse-pnclaude
andcommitted
🐛 fix: type mismatch in dtp_download_file corrupted payload_id
dtp_prepare_session() expects (uint8_t timeout, uint8_t payload_id, uint16_t mtu) but we were passing (uint32_t, uint16_t, uint32_t). The wider types shifted subsequent arguments on the stack, causing the server to receive payload_id=4 (high byte of mtu=1024) instead of the actual payload_id=1. Fix: match dtp_download_file signature to the library's exact types. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent fdce5ef commit 268b5e4

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

satdeploy-agent/include/satdeploy_agent.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,12 @@ int backup_list(const char *app_name, backup_list_callback callback, void *user_
120120
* @param expected_size Expected file size (0 to skip size check).
121121
* @param mtu Max transmission unit (0 = use default 1024).
122122
* @param throughput Target throughput in bytes/s (0 = use default 10 MB/s).
123-
* @param timeout Transfer timeout in seconds (0 = use default 60).
123+
* @param timeout Transfer timeout in seconds (0 = use default 60, max 255).
124124
* @return 0 on success, -1 on failure.
125125
*/
126-
int dtp_download_file(uint32_t server_node, uint16_t payload_id,
126+
int dtp_download_file(uint32_t server_node, uint8_t payload_id,
127127
const char *dest_path, uint32_t expected_size,
128-
uint32_t mtu, uint32_t throughput, uint32_t timeout);
128+
uint16_t mtu, uint32_t throughput, uint8_t timeout);
129129

130130
/**
131131
* Save app deployment metadata.

satdeploy-agent/src/dtp_client.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ static void on_download_release(dtp_t *session) {
9898
/* Nothing to clean up - context is on stack */
9999
}
100100

101-
int dtp_download_file(uint32_t server_node, uint16_t payload_id,
101+
int dtp_download_file(uint32_t server_node, uint8_t payload_id,
102102
const char *dest_path, uint32_t expected_size,
103-
uint32_t mtu, uint32_t throughput, uint32_t timeout) {
103+
uint16_t mtu, uint32_t throughput, uint8_t timeout) {
104104
if (dest_path == NULL) {
105105
return -1;
106106
}

0 commit comments

Comments
 (0)