[Crosstoolchain-logs] [device-tree-compiler] 134/357: libfdt: Fix use of uninitialized variable in fdt_get_path()

Hector Oron zumbi at moszumanska.debian.org
Thu Dec 8 17:06:06 UTC 2016


This is an automated email from the git hooks/post-receive script.

zumbi pushed a commit to branch upstream/1.3.x
in repository device-tree-compiler.

commit e2b3bb32276252a922c0b02981d0fd998766feef
Author: David Gibson <david at gibson.dropbear.id.au>
Date:   Fri Aug 31 14:30:16 2007 +1000

    libfdt: Fix use of uninitialized variable in fdt_get_path()
    
    My recent implemenetation of fdt_get_path() had a bug - the while loop
    tested offset which was unitialized on the first iteration.  Depending
    on code surrounding the call, this could cause fdt_get_path() to
    return incorrect results.
    
    This patch corrects the problem by applying some more correct thinking
    to the loop condition.
    
    Signed-off-by: David Gibson <david at gibson.dropbear.id.au>
---
 libfdt/fdt_ro.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libfdt/fdt_ro.c b/libfdt/fdt_ro.c
index dc4a596..65bd1a2 100644
--- a/libfdt/fdt_ro.c
+++ b/libfdt/fdt_ro.c
@@ -302,7 +302,7 @@ int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen)
 	buf[0] = '/';
 	p = 1;
 
-	while (offset < nodeoffset) {
+	while (nextoffset <= nodeoffset) {
 		offset = nextoffset;
 		tag = _fdt_next_tag(fdt, offset, &nextoffset);
 		switch (tag) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/crosstoolchain/device-tree-compiler.git



More information about the Crosstoolchain-logs mailing list