Gitweb:        
http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=9a862be8758a6b72be39ccd78c26d40bc556747b
Commit:        9a862be8758a6b72be39ccd78c26d40bc556747b
Parent:        63274de1dd018dd374abf2aa20acb5b9e47e0313
Author:        David Lutterkort <[email protected]>
AuthorDate:    Wed Jul 8 11:44:00 2009 -0700
Committer:     David Lutterkort <[email protected]>
CommitterDate: Wed Jul 8 11:44:00 2009 -0700

* src/augeas.c (init_root): when root0 == "", use "/" as root

When an empty string is passed as root0, make sure we do not make an
invalid memory access when we look for the trailing slash.

Reported and fix suggested by Jeff Johnson <[email protected]>
---
 src/augeas.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/augeas.c b/src/augeas.c
index 192a79a..90b51f9 100644
--- a/src/augeas.c
+++ b/src/augeas.c
@@ -156,7 +156,7 @@ static const char *init_root(const char *root0) {
 
     if (root0 == NULL)
         root0 = getenv(AUGEAS_ROOT_ENV);
-    if (root0 == NULL)
+    if (root0 == NULL || root0[0] == '\0')
         root0 = "/";
     root = strdup(root0);
     if (root == NULL)

_______________________________________________
augeas-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/augeas-devel

Reply via email to