From: Alberto Leiva Popper Date: Wed, 29 Sep 2021 00:01:00 +0000 (-0500) Subject: RRDP: Patch deltas foreach X-Git-Tag: 1.5.2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=189e398bbc9f5d41a854c179ec152a7903067b33;p=thirdparty%2FFORT-validator.git RRDP: Patch deltas foreach The foreach was looping past the array limits. Likely fixes #57. --- diff --git a/src/rrdp/rrdp_objects.c b/src/rrdp/rrdp_objects.c index a885bf25..7898c30f 100644 --- a/src/rrdp/rrdp_objects.c +++ b/src/rrdp/rrdp_objects.c @@ -44,15 +44,15 @@ deltas_head_for_each(struct deltas_head *deltas, unsigned long max_serial, int error; /* No elements, send error so that the snapshot is processed */ - if (deltas->capacity == 0) { + if (deltas->len == 0) { pr_val_warn("There's no delta list to process."); return -ENOENT; } pr_val_debug("Getting RRDP deltas from serial %lu to %lu.", from_serial, max_serial); - from = deltas->capacity - (max_serial - from_serial); - for (index = from; index < deltas->capacity; index++) { + from = deltas->len - (max_serial - from_serial); + for (index = from; index < deltas->len; index++) { error = cb(&deltas->array[index], arg); if (error) return error; diff --git a/src/rrdp/rrdp_parser.c b/src/rrdp/rrdp_parser.c index bc67c0e2..889b73f8 100644 --- a/src/rrdp/rrdp_parser.c +++ b/src/rrdp/rrdp_parser.c @@ -905,7 +905,7 @@ process_delta(struct delta_head *delta_head, void *arg) head_data = &delta_head->doc_data; - pr_val_debug("Processing delta '%s'.", delta_head->doc_data.uri); + pr_val_debug("Processing delta '%s'.", head_data->uri); error = uri_create_https_str_rrdp(&uri, head_data->uri, strlen(head_data->uri)); if (error)