Hi Charles, Neil, On Sat, 20 Oct 2018 07:52:53 -0400, Neil Horman wrote: > On Fri, Oct 19, 2018 at 10:51:49PM +0000, [email protected] wrote: > > From: Charles Rose <[email protected]> > > > > Redfish Hostname prints beyond hlen characters. Fix it. > > > > Signed-off-by: Charles Rose <[email protected]> > > --- > > dmidecode.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/dmidecode.c b/dmidecode.c > > index a3e9d6c..7ac6438 100644 > > --- a/dmidecode.c > > +++ b/dmidecode.c > > @@ -3609,7 +3609,7 @@ static void dmi_parse_protocol_record(const char > > *prefix, u8 *rec) > > hname = out_of_spec; > > hlen = strlen(out_of_spec); > > } > > - printf("%s\t\tRedfish Service Hostname: %*s\n", prefix, hlen, hname); > > + printf("%s\t\tRedfish Service Hostname: %.*s\n", prefix, hlen, hname); > > } > > > > /* > > -- > > 1.8.3.1 > > > Yup, last part of the Precision section from the man page specifies this: > > Precision > An optional precision, in the form of a period ('.') followed by an > optional decimal digit string. Instead of a decimal digit string one may > write "*" or "*m$" (for some decimal integer m) to > specify that the precision is given in the next argument, or in the > m-th argument, respectively, which must be of type int. If the precision is > given as just '.', the precision is taken to be zero. > A negative precision is taken as if the precision were omitted. This > gives the minimum number of digits to appear for d, i, o, u, x, and X > conversions, the number of digits to appear after the > radix character for a, A, e, E, f, and F conversions, the maximum > number of significant digits for g and G conversions, or the maximum number > of characters to be printed from a string for s and S > conversions. > > Acked-by: Neil Horman <[email protected]>
Good catch, thanks for reporting and fixing. I have added a Fixes tag and committed v2 of your fix: http://git.savannah.nongnu.org/cgit/dmidecode.git/commit/?id=fde47bb227b8fa817c88d7e10a8eb771c46de1df I have also added it to the list of recommended fixes on the web page. -- Jean Delvare SUSE L3 Support _______________________________________________ https://lists.nongnu.org/mailman/listinfo/dmidecode-devel
