Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1750)

Unified Diff: sysdeps/nacl/sysdep.h

Issue 759833008: NaCl: Fix off-by-one in getcwd() syscall emulation. (Closed) Base URL: http://git.chromium.org/native_client/nacl-glibc.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sysdeps/nacl/sysdep.h
diff --git a/sysdeps/nacl/sysdep.h b/sysdeps/nacl/sysdep.h
index 2e2b8b09bd908bccc50e9d42a2845249896d1a2c..49fa28d22c13caa5ebaf7d6cd57522112acb14ef 100644
--- a/sysdeps/nacl/sysdep.h
+++ b/sysdeps/nacl/sysdep.h
@@ -5,6 +5,7 @@
#include <futex_emulation.h>
#include <irt_syscalls.h>
#include <lowlevellock.h>
+#include <string.h>
/* Implementation of all syscalls for use in platform- and OS- independent code
as inline functions. Each function translates the syscall arguments into IRT
@@ -598,8 +599,7 @@ INTERNAL_SYSCALL_getcwd_2 (int *err, char *buf, size_t size)
if (*err) {
return 0;
}
- for (len = 0; len < size && buf[len] != '\0'; ++len);
- return len;
+ return __strnlen(buf, size - 1) + 1;
}
__extern_always_inline gid_t
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698