check file size
This commit is contained in:
parent
894aa48906
commit
14e187f1e2
1 changed files with 6 additions and 0 deletions
|
|
@ -560,6 +560,7 @@ struct udev_device *udev_device_new_from_file(struct udev *udev, const char *pat
|
|||
char line[LINE_MAX], syspath[PATH_MAX], devnode[PATH_MAX];
|
||||
struct udev_device *udev_device;
|
||||
char *pos, *sysname;
|
||||
struct stat st;
|
||||
FILE *file;
|
||||
int i;
|
||||
|
||||
|
|
@ -569,6 +570,11 @@ struct udev_device *udev_device_new_from_file(struct udev *udev, const char *pat
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (stat(path, &st) != 0 || st.st_size > 8192) {
|
||||
free(udev_device);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
file = fopen(path, "r");
|
||||
|
||||
if (!file) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue