mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-19 21:27:57 +00:00
don't crash on manifests close to 1024 bytes long
This commit is contained in:
parent
b0b5edc573
commit
029adc177f
15
monitor.c
15
monitor.c
@ -652,14 +652,19 @@ static int monitor_help(const struct cli_parsed *parsed, struct cli_context *con
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void monitor_announce_bundle(rhizome_manifest *m)
|
static void monitor_announce_bundle(rhizome_manifest *m)
|
||||||
{
|
{
|
||||||
char msg[1024];
|
// This message can contain the entire manifest, which itself can be 1024 bytes long.
|
||||||
|
// Thus we need to allow more space.
|
||||||
|
char msg[2048];
|
||||||
int len = snprintf(msg,1024,"\n*%zd:BUNDLE:%s\n",
|
int len = snprintf(msg,1024,"\n*%zd:BUNDLE:%s\n",
|
||||||
m->manifest_all_bytes,
|
m->manifest_all_bytes,
|
||||||
alloca_tohex_rhizome_bid_t(m->keypair.public_key));
|
alloca_tohex_rhizome_bid_t(m->keypair.public_key));
|
||||||
bcopy(m->manifestdata, &msg[len], m->manifest_all_bytes);
|
|
||||||
len+=m->manifest_all_bytes;
|
if ((len+m->manifest_all_bytes)<sizeof(msg)) {
|
||||||
msg[len++]='\n';
|
bcopy(m->manifestdata, &msg[len], m->manifest_all_bytes);
|
||||||
|
len+=m->manifest_all_bytes;
|
||||||
|
msg[len++]='\n';
|
||||||
|
}
|
||||||
monitor_tell_clients(msg, len, MONITOR_RHIZOME);
|
monitor_tell_clients(msg, len, MONITOR_RHIZOME);
|
||||||
}
|
}
|
||||||
DEFINE_TRIGGER(bundle_add, monitor_announce_bundle);
|
DEFINE_TRIGGER(bundle_add, monitor_announce_bundle);
|
||||||
|
Loading…
Reference in New Issue
Block a user