From: Phil Sutter Date: Tue, 26 Jan 2021 17:52:15 +0000 (+0100) Subject: erec: Sanitize erec location indesc X-Git-Tag: v0.9.9~125 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2f89bc258e6e06ec4eeccc9efa52f01b4118e359;p=thirdparty%2Fnftables.git erec: Sanitize erec location indesc erec_print() unconditionally dereferences erec->locations->indesc, so make sure it is valid when either creating an erec or adding a location. Signed-off-by: Phil Sutter --- diff --git a/src/erec.c b/src/erec.c index c550a596..5c3351a5 100644 --- a/src/erec.c +++ b/src/erec.c @@ -38,7 +38,8 @@ void erec_add_location(struct error_record *erec, const struct location *loc) { assert(erec->num_locations < EREC_LOCATIONS_MAX); erec->locations[erec->num_locations] = *loc; - erec->locations[erec->num_locations].indesc = loc->indesc; + erec->locations[erec->num_locations].indesc = loc->indesc ? + : &internal_indesc; erec->num_locations++; }