Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1222144

[PATCH 1/2] staging: dgap: fix possible NULL dereference

Path csiph.com!goblin3!goblin2!goblin.stu.neva.ru!aioe.org!bofh.it!news.nic.it!robomod
From Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Newsgroups linux.kernel
Subject [PATCH 1/2] staging: dgap: fix possible NULL dereference
Date Thu, 10 Sep 2015 14:00:02 +0200
Message-ID <q78Ge-vY-7@gated-at.bofh.it> (permalink)
X-Original-To Lidza Louina <lidza.louina@gmail.com>, Mark Hounschell <markh@compro.net>, Daeseok Youn <daeseok.youn@gmail.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=mXH1VvAmhYBWsYtkSl3jFFFBK4q0VoNoDeRAFAAeQfg=; b=M7G7lhOV49uKOaC4G/v/XIop/T8PAR0BsHhebCyA1PHHqGCZQiiDQ2+w/PE3KB8l86 lGNPSFO+dnl2pgzicjE9rrg6Uqk+HV7+YXLyINFikdNuPIiXtSp5qrdSI/xJ3D+bWV7P UONfWswcHt2LtBX+OpXnOn4O5qkaTVEA3euVmmKodvyehEg/NO4PCaqPITPz7+cqOTHl 9/OBpVEPuARINOgOFe9y+BlA3hB6ZwsSNhIQiEAQMuuuGE51vd6NbnxkYB0BztzIrPNH 50FEnJ5YTJ8OnX3p7BJug8cRxzmc1rts9idU9gJmZFfMGzXVsXEqp9lFDn3Ls6tRNPgE E/Ug==
X-Received by 10.66.246.228 with SMTP id xz4mr74218997pac.46.1441886108035; Thu, 10 Sep 2015 04:55:08 -0700 (PDT)
X-Mailer git-send-email 1.9.1
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 30
Organization linux.* mail to news gateway
X-Original-Cc linux-kernel@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org, Sudip Mukherjee <sudipm.mukherjee@gmail.com>
X-Original-Date Thu, 10 Sep 2015 17:24:58 +0530
X-Original-Message-ID <1441886099-24399-1-git-send-email-sudipm.mukherjee@gmail.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1222144

Show key headers only | View raw


The return pointer from dgap_getword() is used in strcmp() where it is
dereferenced. But dgap_getword() can return NULL.
Lets put a check there and return 0 as error.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 drivers/staging/dgap/dgap.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index 9112dd2..20ba258 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -349,6 +349,8 @@ static int dgap_gettok(char **in)
 
 	if (strstr(dgap_cword, "board")) {
 		w = dgap_getword(in);
+		if (!w)
+			return 0;
 		snprintf(dgap_cword, MAXCWORD, "%s", w);
 		for (t = dgap_brdtype; t->token != 0; t++) {
 			if (!strcmp(w, t->string))
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] staging: dgap: fix possible NULL dereference Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-09-10 14:00 +0200
  Re: [PATCH 1/2] staging: dgap: fix possible NULL dereference Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-12 06:40 +0200

csiph-web