Fix off-by-one errors in *scanf format strings.
In the first hunk, the format string was off-by-one for cmd, and cmd
itself was larger than the maximum size required. cmd was reduced in
size and the format string adjusted.
In the second hunk, the format string was off-by-one for local_address,
remote_address and extra, although the buffers for the two addresses
were large enough for this not to matter. The specifiers for the two
addresses was corrected, and a number of unused variables including
extra were suppressed from parsing.
In the third hunk, the format string was off-by-one for name,
dependencies and status. This code was rewritten using strtok since
dependencies can be arbitrarily long.
gdb/
2013-10-23 Gary Benson <gbenson@redhat.com>
PR 16013
* common/linux-osdata.c (command_from_pid): Reduced size of cmd
from 32 to 18. Adjusted fscanf format string accordingly.
(Avoids leaving cmd unterminated.)
(print_sockets): Do not parse tlen, inode, sl, timeout, txq, rxq,
trun, retn or extra. (Avoids leaving extra unterminated.) Check
that local_address and remote_address will not overflow.
(linux_xfer_osdata_modules): Parse lines using strtok to avoid
leaving dependencies unterminated. Parse size as "%u" to match
definition.