Module: xenomai-forge
Branch: master
Commit: c8b3b90b0a00840c4197fce153b702745082dc72
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=c8b3b90b0a00840c4197fce153b702745082dc72

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Mon Jul  2 19:55:54 2012 +0200

nucleus/vfile: avoid buffer overflow

---

 kernel/cobalt/nucleus/vfile.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/cobalt/nucleus/vfile.c b/kernel/cobalt/nucleus/vfile.c
index a228958..569e8ae 100644
--- a/kernel/cobalt/nucleus/vfile.c
+++ b/kernel/cobalt/nucleus/vfile.c
@@ -805,7 +805,7 @@ ssize_t xnvfile_get_blob(struct xnvfile_input *input,
 {
        ssize_t nbytes = input->size;
 
-       if (nbytes < size)
+       if (nbytes > size)
                nbytes = size;
 
        if (nbytes > 0 && copy_from_user(data, input->u_buf, nbytes))
@@ -898,7 +898,7 @@ ssize_t xnvfile_get_integer(struct xnvfile_input *input, 
long *valp)
        ssize_t nbytes;
        long val;
 
-       nbytes = xnvfile_get_blob(input, buf, sizeof(buf));
+       nbytes = xnvfile_get_blob(input, buf, sizeof(buf) - 1);
        if (nbytes < 0)
                return nbytes;
 


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

Reply via email to