linux-modules.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Seung-Woo Kim <sw0312.kim@samsung.com>
To: linux-modules@vger.kernel.org, lucas.de.marchi@gmail.com
Cc: gladkov.alexey@gmail.com, sw0312.kim@samsung.com, sungguk.na@samsung.com
Subject: [PATCH 1/2] libkmod: fix an overflow with wrong modules.builtin.modinfo
Date: Tue, 13 Apr 2021 20:23:14 +0900	[thread overview]
Message-ID: <20210413112315.18907-2-sw0312.kim@samsung.com> (raw)
In-Reply-To: <20210413112315.18907-1-sw0312.kim@samsung.com>

Fix a possbile overflow with exact PATH_MAX length modname
in wrong modules.builtin.modinfo.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
---
 libkmod/libkmod-builtin.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libkmod/libkmod-builtin.c b/libkmod/libkmod-builtin.c
index fc9a37644261..a75a542f6942 100644
--- a/libkmod/libkmod-builtin.c
+++ b/libkmod/libkmod-builtin.c
@@ -246,7 +246,7 @@ bool kmod_builtin_iter_get_modname(struct kmod_builtin_iter *iter,
 
 	len = dot - line;
 
-	if (len > PATH_MAX) {
+	if (len >= PATH_MAX) {
 		sv_errno = ENAMETOOLONG;
 		goto fail;
 	}
-- 
2.19.2


  parent reply	other threads:[~2021-04-13 11:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20210413112018epcas1p15c2cb9693086133c145845030df145ef@epcas1p1.samsung.com>
2021-04-13 11:23 ` [PATCH 0/2] harden libkmod-builtin with wrong modules.builtin.modinfo Seung-Woo Kim
     [not found]   ` <CGME20210413112018epcas1p4e7e6b23060a83694867b07a1f1afc200@epcas1p4.samsung.com>
2021-04-13 11:23     ` Seung-Woo Kim [this message]
     [not found]   ` <CGME20210413112019epcas1p22c64b861d296333a64c348020c7ca20e@epcas1p2.samsung.com>
2021-04-13 11:23     ` [PATCH 2/2] libkmod: fix possible double free " Seung-Woo Kim
2021-04-17 20:58   ` [PATCH 0/2] harden libkmod-builtin " Lucas De Marchi

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=20210413112315.18907-2-sw0312.kim@samsung.com \
    --to=sw0312.kim@samsung.com \
    --cc=gladkov.alexey@gmail.com \
    --cc=linux-modules@vger.kernel.org \
    --cc=lucas.de.marchi@gmail.com \
    --cc=sungguk.na@samsung.com \
    /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).