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

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

nucleus/vfile: avoid buffer overflow

---

 ksrc/nucleus/vfile.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/ksrc/nucleus/vfile.c b/ksrc/nucleus/vfile.c
index 5928aef..a6ad363 100644
--- a/ksrc/nucleus/vfile.c
+++ b/ksrc/nucleus/vfile.c
@@ -2,7 +2,7 @@
  * @file
  * This file is part of the Xenomai project.
  *
- * @note Copyright (C) 2010 Philippe Gerum <r...@xenomai.org> 
+ * @note Copyright (C) 2010 Philippe Gerum <r...@xenomai.org>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -811,7 +811,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))
@@ -904,7 +904,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