static size_t binary_ack_pack(char *s, const struct binary_ack *ba)
{
- unsigned int len = strlen(ba->binpath);
+ unsigned int len = strlen(ba->binpath) + 1;
int i;
*(uint32_t *) s = ba->type;
s += sizeof(uint32_t);
if (len)
- memmove(s, ba->binpath, len);
-
- *(s += len) = '\0';
- s += 1;
+ memcpy(s, ba->binpath, len);
+ s += len;
for (i = 0; i!= 16; ++i) {
sprintf(s, "%02x", ba->digest[i]);
}
*s = '\0';
- return sizeof(uint32_t) + len + 1 + 2*16 + 1;
+ return sizeof(uint32_t) + len + 2*16 + 1;
}
static void get_file_md5sum(md5_byte_t digest[16], const char *filename)
return -1;
}
new = binary_ack_alloc(str);
- total_size += binary_ack_size(acks[i]);
/* check for errors */
if (new->type == BINARY_TYPE_FILE_NOT_EXIST) {
error_code = ERR_WRONG_MESSAGE_DATA;
if (new->binpath[0] == '\0')
LOGW("section '.debug_str' not found in <%s>\n", str);
acks[i] = new;
+ total_size += binary_ack_size(new);
}
typedef uint32_t return_id;
typedef uint32_t binary_ack_count;
binary_ack_free(acks[i]);
}
+ printBuf(msg_reply, msg_reply->len + sizeof(*msg_reply));
int err = send_reply(msg_reply);
free(msg_reply);
return err;