char *action;
action = getenv("ACTION");
- if (strlen(action) > ACTION_SIZE)
+ if (action != NULL && strlen(action) > ACTION_SIZE)
action[ACTION_SIZE-1] = '\0';
return action;
char *devpath;
devpath = getenv("DEVPATH");
- if (strlen(devpath) > DEVPATH_SIZE)
+ if (devpath != NULL && strlen(devpath) > DEVPATH_SIZE)
devpath[DEVPATH_SIZE-1] = '\0';
return devpath;
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;