check file size
This commit is contained in:
@@ -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];
|
char line[LINE_MAX], syspath[PATH_MAX], devnode[PATH_MAX];
|
||||||
struct udev_device *udev_device;
|
struct udev_device *udev_device;
|
||||||
char *pos, *sysname;
|
char *pos, *sysname;
|
||||||
|
struct stat st;
|
||||||
FILE *file;
|
FILE *file;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -569,6 +570,11 @@ struct udev_device *udev_device_new_from_file(struct udev *udev, const char *pat
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (stat(path, &st) != 0 || st.st_size > 8192) {
|
||||||
|
free(udev_device);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
file = fopen(path, "r");
|
file = fopen(path, "r");
|
||||||
|
|
||||||
if (!file) {
|
if (!file) {
|
||||||
|
|||||||
Reference in New Issue
Block a user