All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix out of bounds array access in util_create_path()
@ 2009-08-28 17:24 Florian Zumbiehl
  2009-08-30 19:41 ` Kay Sievers
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Zumbiehl @ 2009-08-28 17:24 UTC (permalink / raw)
  To: linux-hotplug

Hi,

while reading some more udev source, I noticed a potential out of bounds
array access in util_create_path(), untested fix below.

Florian

diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c
index 28008c5..15fac7c 100644
--- a/libudev/libudev-util-private.c
+++ b/libudev/libudev-util-private.c
@@ -34,11 +34,13 @@ int util_create_path(struct udev *udev, const char *path)
 
 	util_strscpy(p, sizeof(p), path);
 	pos = strrchr(p, '/');
-	if (pos = p || pos = NULL)
+	if (pos = NULL)
 		return 0;
-
-	while (pos[-1] = '/')
+	while (pos != p && pos[-1] = '/')
 		pos--;
+	if (pos = p)
+		return 0;
+
 	pos[0] = '\0';
 
 	dbg(udev, "stat '%s'\n", p);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] fix out of bounds array access in util_create_path()
  2009-08-28 17:24 [PATCH] fix out of bounds array access in util_create_path() Florian Zumbiehl
@ 2009-08-30 19:41 ` Kay Sievers
  0 siblings, 0 replies; 2+ messages in thread
From: Kay Sievers @ 2009-08-30 19:41 UTC (permalink / raw)
  To: linux-hotplug

On Fri, Aug 28, 2009 at 19:24, Florian Zumbiehl<florz@florz.de> wrote:
> while reading some more udev source, I noticed a potential out of bounds
> array access in util_create_path(), untested fix below.

Applied.

Thanks,
Kay

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-08-30 19:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-28 17:24 [PATCH] fix out of bounds array access in util_create_path() Florian Zumbiehl
2009-08-30 19:41 ` Kay Sievers

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.