Module: xenomai-gch Branch: for-forge Commit: a404efaed928d4db5c0b085003556c8e0971d2c7 URL: http://git.xenomai.org/?p=xenomai-gch.git;a=commit;h=a404efaed928d4db5c0b085003556c8e0971d2c7
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