projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
canonicalize: avoid uninitialized memory use
[gnulib.git]
/
lib
/
canonicalize-lgpl.c
diff --git
a/lib/canonicalize-lgpl.c
b/lib/canonicalize-lgpl.c
index
a61bef9
..
7aa2d92
100644
(file)
--- a/
lib/canonicalize-lgpl.c
+++ b/
lib/canonicalize-lgpl.c
@@
-156,8
+156,12
@@
__realpath (const char *name, char *resolved)
{
rpath[0] = '/';
dest = rpath + 1;
{
rpath[0] = '/';
dest = rpath + 1;
- if (DOUBLE_SLASH_IS_DISTINCT_ROOT && name[1] == '/' && name[2] != '/')
- *dest++ = '/';
+ if (DOUBLE_SLASH_IS_DISTINCT_ROOT)
+ {
+ if (name[1] == '/' && name[2] != '/')
+ *dest++ = '/';
+ *dest = '\0';
+ }
}
for (start = end = name; *start; start = end)
}
for (start = end = name; *start; start = end)
@@
-298,9
+302,12
@@
__realpath (const char *name, char *resolved)
if (buf[0] == '/')
{
dest = rpath + 1; /* It's an absolute symlink */
if (buf[0] == '/')
{
dest = rpath + 1; /* It's an absolute symlink */
- if (DOUBLE_SLASH_IS_DISTINCT_ROOT
- && buf[1] == '/' && buf[2] != '/')
- *dest++ = '/';
+ if (DOUBLE_SLASH_IS_DISTINCT_ROOT)
+ {
+ if (buf[1] == '/' && buf[2] != '/')
+ *dest++ = '/';
+ *dest = '\0';
+ }
}
else
{
}
else
{