fprintf: Set tconf.type_spacing earlier
As there are cases where we jump to the type not found label without having done the full copy of *conf to tconf, so at least the type_spacing needs to have been set. This addresses this coverity report entry: Error: UNINIT (CWE-457): [#def23] dwarves-1.13/dwarves_fprintf.c:600: var_decl: Declaring variable "tconf" without initializer. dwarves-1.13/dwarves_fprintf.c:779: uninit_use_in_call: Using uninitialized value "tconf.type_spacing" when calling "fprintf". # 777| return printed; # 778| out_type_not_found: # 779|-> printed = fprintf(fp, "%-*s %s", tconf.type_spacing, "<ERROR>", name); # 780| goto out; # 781| } Reported-by: William Cohen <wcohen@redhat.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
c6a9a0eb6a
commit
d5e01d10e5
|
@ -598,7 +598,9 @@ static size_t type__fprintf(struct tag *type, const struct cu *cu,
|
|||
char namebfptr[258];
|
||||
struct type *ctype;
|
||||
struct tag *type_expanded = NULL;
|
||||
struct conf_fprintf tconf;
|
||||
struct conf_fprintf tconf = {
|
||||
.type_spacing = conf->type_spacing,
|
||||
};
|
||||
size_t printed = 0;
|
||||
int expand_types = conf->expand_types;
|
||||
int suppress_offset_comment = conf->suppress_offset_comment;
|
||||
|
|
Loading…
Reference in New Issue