zdev: Harden against invalid firmware data

Reduce chances of unintended side-effects when evaluating firmware
data which might have been corrupted.

Reviewed-by: Vineeth Vijayan <vneethv@linux.ibm.com>
Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Peter Oberparleiter
2026-07-07 13:25:41 +02:00
committed by Jan Höppner
parent a048670bec
commit 360e8d4156
2 changed files with 39 additions and 8 deletions

View File

@@ -16,6 +16,12 @@
/* Valid control-program identifier special characters */
#define VALID_CPNAME "/"
/* Valid attribute key special characters */
#define VALID_ATTRKEY "/:"
/* Valid attribute value special characters */
#define VALID_ATTRVAL "/-+:.,_ "
static inline int is_safe_char(unsigned char c, const char *set)
{
return isalnum(c) || strchr(set, c);