diff options
author | Phil Sutter <phil@nwl.cc> | 2021-01-26 18:52:15 +0100 |
---|---|---|
committer | Phil Sutter <phil@nwl.cc> | 2021-02-09 17:00:09 +0100 |
commit | 2f89bc258e6e06ec4eeccc9efa52f01b4118e359 (patch) | |
tree | d868a24ea6bbab3df1e87ddaaf6825bdc6794cd8 /src/erec.c | |
parent | 45f5a1f9786f8908f41fc4fd62b90688ec407a18 (diff) |
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 <phil@nwl.cc>
Diffstat (limited to 'src/erec.c')
-rw-r--r-- | src/erec.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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++; } |