From 3fe0734266becd2ebcb111b07c3e17b2a9780477 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 26 Feb 2004 19:40:40 -0800 Subject: [PATCH] udev - safer string handling - part four Mainly a cleanup of the earlier patches with a few missing pieces and some cosmetical changes. I've moved the udev_init_config() to very early init, otherwise we don't get any logging for the processing of the input. What would I do without gdb :) Greg, it's the 7th patch in your box to apply. I will stop now and wait for you :) --- udev.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'udev.h') diff --git a/udev.h b/udev.h index fa56c36691..3b676acf40 100644 --- a/udev.h +++ b/udev.h @@ -90,7 +90,7 @@ static inline char *get_action(void) char *action; action = getenv("ACTION"); - if (strlen(action) > ACTION_SIZE) + if (action != NULL && strlen(action) > ACTION_SIZE) action[ACTION_SIZE-1] = '\0'; return action; @@ -101,7 +101,7 @@ static inline char *get_devpath(void) char *devpath; devpath = getenv("DEVPATH"); - if (strlen(devpath) > DEVPATH_SIZE) + if (devpath != NULL && strlen(devpath) > DEVPATH_SIZE) devpath[DEVPATH_SIZE-1] = '\0'; return devpath; @@ -118,7 +118,7 @@ static inline char *get_seqnum(void) static inline char *get_subsystem(char *subsystem) { - if (strlen(subsystem) > SUBSYSTEM_SIZE) + if (subsystem != NULL && strlen(subsystem) > SUBSYSTEM_SIZE) subsystem[SUBSYSTEM_SIZE-1] = '\0'; return subsystem; -- cgit v1.2.3-54-g00ecf