Skip to content

don't build printf formats out of names

Stephen Hemminger netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3lib: don't build printf formats out of nameslib/json_print.c+2 -50 replies
2/3rdma: don't build printf formats out of keysrdma/res-cmid.c rdma/res.c rdma/utils.c+9 -81 reply
3/3vdpa: don't build printf format out of vendor stats namevdpa/vdpa.c+3 -110 replies

Reviews trailers per patch

1 of 3 patches has a Reviewed-by or Acked-by.

PatchLeon Romanovsky
1/3
2/3R-b
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH iproute2 0/3] don't build printf formats out of names

Several print helpers built a printf format string by concatenating a name or key onto a conversion specifier, then passed the result to printf as the format. This is unsafe since '%' in name would be converted by printf.

Most of the affected names are string literals, but the rdma driver attribute and hwcounter keys and the vdpa vendor statistics names come from the kernel, so they are not under iproute2's control. No failures have been reported in practice. Each patch passes the name as a normal string argument with a literal format instead; text and JSON output are otherwise unchanged.

Found by an automated source scan (ANT-2026-JAWA8082).

Stephen Hemminger (3):
lib: don't build printf formats out of names
rdma: don't build printf formats out of keys
vdpa: don't build printf format out of vendor stats name

 lib/json_print.c |  7 ++-----
 rdma/res-cmid.c  |  3 ++-
 rdma/res.c       | 10 +++++-----
 rdma/utils.c     |  4 ++--
 vdpa/vdpa.c      | 14 +++-----------
 5 files changed, 14 insertions(+), 24 deletions(-)
Signature · 1 line
2.53.0