If job %0 is (mistakenly) specified, an out-of-bounds access to the
jobtab occurs in function getjob() if num = 0:

        jp = jobtab + 0 - 1

Fix this by checking that the job number is larger than 0 before
accessing the jobtab.

Signed-off-by: Tobias Klauser <tklau...@distanz.ch>
---
 src/jobs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/jobs.c b/src/jobs.c
index c2c2332a25fa..39978635d891 100644
--- a/src/jobs.c
+++ b/src/jobs.c
@@ -699,7 +699,7 @@ check:
 
        if (is_number(p)) {
                num = atoi(p);
-               if (num <= njobs) {
+               if (num > 0 && num <= njobs) {
                        jp = jobtab + num - 1;
                        if (jp->used)
                                goto gotit;
-- 
2.6.3.368.gf34be46.dirty


--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to