]> www.infradead.org Git - users/dwmw2/linux.git/commit
tools: ynl-gen: validate 0 len strings from kernel
authorDavid Wei <dw@davidwei.uk>
Sat, 3 May 2025 04:30:50 +0000 (21:30 -0700)
committerJakub Kicinski <kuba@kernel.org>
Tue, 6 May 2025 01:17:47 +0000 (18:17 -0700)
commit4720f9707c783f642332dee3d56dccaefa850e42
treea2524ed16f0ecf972fd1c1bae30b0ceb4723c88f
parentc645a6b2f3962bc6cc89ae8da7cac403c08023a6
tools: ynl-gen: validate 0 len strings from kernel

Strings from the kernel are guaranteed to be null terminated and
ynl_attr_validate() checks for this. But it doesn't check if the string
has a len of 0, which would cause problems when trying to access
data[len - 1]. Fix this by checking that len is positive.

Signed-off-by: David Wei <dw@davidwei.uk>
Link: https://patch.msgid.link/20250503043050.861238-1-dw@davidwei.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/net/ynl/lib/ynl.c