Module: xenomai-3
Branch: next
Commit: 4120d9751c9124d35782b525b7c677a4f20f042c
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=4120d9751c9124d35782b525b7c677a4f20f042c

Author: Jorge Ramirez-Ortiz <j...@xenomai.org>
Date:   Thu Aug  6 16:38:15 2015 -0400

lib/analogy: validate size of calibration file

Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-or...@linaro.org>

---

 lib/analogy/calibration.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/analogy/calibration.c b/lib/analogy/calibration.c
index c54cd7d..14ca454 100644
--- a/lib/analogy/calibration.c
+++ b/lib/analogy/calibration.c
@@ -200,10 +200,14 @@ int a4l_read_calibration_file(char *name, struct 
a4l_calibration_data *data)
        int i, j, k, index = -1, nb_elements = -1;
        struct a4l_calibration_subdev_data *p = NULL;
        struct _dictionary_ *d;
+       struct stat st;
 
        if (access(name, R_OK))
                return -1;
 
+       if (stat(name, &st) || !st.st_size)
+               return -1;
+
        d = iniparser_load(name);
        if (d == NULL)
                return -1;


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://xenomai.org/mailman/listinfo/xenomai-git

Reply via email to