diff options
author | arnd@arndb.de <arnd@arndb.de> | 2003-11-18 21:39:30 -0800 |
---|---|---|
committer | Greg KH <gregkh@suse.de> | 2005-04-26 21:06:24 -0700 |
commit | 70033702cda3b13150426cd176a31713d48394d9 (patch) | |
tree | e2ff9e200e0bf0648ea2bac59db354a6ba44e027 /udev.h | |
parent | ae2859df40ef80d15dff39fadd470a8541bab857 (diff) |
[PATCH] more robust config file parsing in namedev.c
After getting a number of different crashes for udev reading broken
udev.config files, I decided to try to make the parser a little
more robust.
The behaviour is changed to stop reading the configuration file
and logging the broken entry instead of silently ignoring it (is
that good? It's easy to just print and continue).
All strcpy()'s to a fixed length string are now implicitly limited
to the bounds of the target string.
I kept the -ENODEV return code for now, not sure if there should be
different ones.
Diffstat (limited to 'udev.h')
-rw-r--r-- | udev.h | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -70,6 +70,12 @@ struct udevice { mode_t mode; }; +#define strfieldcpy(to, from) \ +do { \ + to[sizeof(to)-1] = '\0'; \ + strncpy(to, from, sizeof(to)-1); \ +} while (0) + extern int udev_add_device(char *path, char *subsystem); extern int udev_remove_device(char *path, char *subsystem); |