git.samba.org
/
sahlberg
/
remote-cache.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c68a919
)
make sure we null terminate the string we return in _readlink()
author
root
<root@rcn1.VSOFS1.COM>
Fri, 6 Mar 2009 03:19:21 +0000
(14:19 +1100)
committer
root
<root@rcn1.VSOFS1.COM>
Fri, 6 Mar 2009 03:19:21 +0000
(14:19 +1100)
migrate/remote-cache.c
patch
|
blob
|
history
diff --git
a/migrate/remote-cache.c
b/migrate/remote-cache.c
index e0decaaa77728a87f90188a479be10cb4245f177..59a0a24591e2d42f217399491ff8ef20a47c26e2 100644
(file)
--- a/
migrate/remote-cache.c
+++ b/
migrate/remote-cache.c
@@
-978,13
+978,16
@@
static int remote_cache_readlink(const char *path, char *buf, size_t len)
ssize_t lsize;
int ret = 0;
- DEBUG(DEBUG_DEBUG, (__location__ " READLINK %s
\n", path
));
+ DEBUG(DEBUG_DEBUG, (__location__ " READLINK %s
len:%d\n", path, (int)len
));
old_path = talloc_asprintf(mem_ctx, "%s/%s", remote, path);
lsize = readlink(old_path, buf, len);
if (lsize == -1) {
ret = -errno;
goto finished;
}
+ if (lsize < len) {
+ buf[lsize] = 0;
+ }
finished:
talloc_free(mem_ctx);