From: Tobias Klauser <tklauser@distanz.ch>
To: herbert@gondor.apana.org.au
Cc: dash@vger.kernel.org
Subject: [PATCH] jobs: Don't attempt to access job table for job %0
Date: Thu, 10 Dec 2015 08:59:34 +0100 [thread overview]
Message-ID: <1449734374-23041-1-git-send-email-tklauser@distanz.ch> (raw)
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 <tklauser@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
next reply other threads:[~2015-12-10 7:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-10 7:59 Tobias Klauser [this message]
2016-06-06 11:57 ` jobs: Don't attempt to access job table for job %0 Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1449734374-23041-1-git-send-email-tklauser@distanz.ch \
--to=tklauser@distanz.ch \
--cc=dash@vger.kernel.org \
--cc=herbert@gondor.apana.org.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).