Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bhyve/bhyverun.c
Show First 20 Lines • Show All 227 Lines • ▼ Show 20 Lines | usage(int code) | ||||
" -s: <slot,driver,configinfo> PCI slot config\n" | " -s: <slot,driver,configinfo> PCI slot config\n" | ||||
" -S: guest memory cannot be swapped\n" | " -S: guest memory cannot be swapped\n" | ||||
" -u: RTC keeps UTC time\n" | " -u: RTC keeps UTC time\n" | ||||
" -U: uuid\n" | " -U: uuid\n" | ||||
" -w: ignore unimplemented MSRs\n" | " -w: ignore unimplemented MSRs\n" | ||||
" -W: force virtio to use single-vector MSI\n" | " -W: force virtio to use single-vector MSI\n" | ||||
" -x: local apic is in x2APIC mode\n" | " -x: local apic is in x2APIC mode\n" | ||||
" -Y: disable MPtable generation\n", | " -Y: disable MPtable generation\n", | ||||
progname, (int)strlen(progname), "", (int)strlen(progname), "", | progname, (int)strnlen(progname, PATH_MAX), "", (int)strnlen(progname, PATH_MAX), "", | ||||
(int)strlen(progname), ""); | (int)strnlen(progname, PATH_MAX), ""); | ||||
imp: While using strlnlen() here will guard against the insane notion that progname could be longer… | |||||
Done Inline Actions@imp do you have any suggestion for the fprintf case? araujo: @imp do you have any suggestion for the fprintf case? | |||||
Not Done Inline Actions@araujo the format string "%.*s" can be used to bound the length of string printed. Similar to the "%*s" padding entries that follow, two arguments are passed to printf for this format: int length, and (const) char * string. Only the first length bytes are formatted. That said, I don't think strnlen() is useful here, so the simpler thing to do is just leave it alone. cem: @araujo the format string `"%.*s"` can be used to bound the length of string printed. Similar… | |||||
exit(code); | exit(code); | ||||
} | } | ||||
/* | /* | ||||
* XXX This parser is known to have the following issues: | * XXX This parser is known to have the following issues: | ||||
* 1. It accepts null key=value tokens ",,". | * 1. It accepts null key=value tokens ",,". | ||||
* 2. It accepts whitespace after = and before value. | * 2. It accepts whitespace after = and before value. | ||||
▲ Show 20 Lines • Show All 977 Lines • Show Last 20 Lines |
While using strlnlen() here will guard against the insane notion that progname could be longer than PATH_MAX, it won't prevent fprintf from outputting an insane number of characters for progname should it be an unbounded string.