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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #ifndef _NACL_SYSDEP_H 1 #ifndef _NACL_SYSDEP_H
2 #define _NACL_SYSDEP_H 1 2 #define _NACL_SYSDEP_H 1
3 3
4 #if !defined(__ASSEMBLER__) 4 #if !defined(__ASSEMBLER__)
5 #include <futex_emulation.h> 5 #include <futex_emulation.h>
6 #include <irt_syscalls.h> 6 #include <irt_syscalls.h>
7 #include <lowlevellock.h> 7 #include <lowlevellock.h>
8 8
9 /* Implementation of all syscalls for use in platform- and OS- independent code 9 /* Implementation of all syscalls for use in platform- and OS- independent code
10 as inline functions. Each function translates the syscall arguments into IRT 10 as inline functions. Each function translates the syscall arguments into IRT
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 The system call just returns the length of the buffer filled (which includes 591 The system call just returns the length of the buffer filled (which includes
592 the ending '\0' character), or zero in case of error. */ 592 the ending '\0' character), or zero in case of error. */
593 __extern_always_inline int 593 __extern_always_inline int
594 INTERNAL_SYSCALL_getcwd_2 (int *err, char *buf, size_t size) 594 INTERNAL_SYSCALL_getcwd_2 (int *err, char *buf, size_t size)
595 { 595 {
596 int len; 596 int len;
597 *err = __nacl_irt_getcwd (buf, size); 597 *err = __nacl_irt_getcwd (buf, size);
598 if (*err) { 598 if (*err) {
599 return 0; 599 return 0;
600 } 600 }
601 for (len = 0; len < size && buf[len] != '\0'; ++len); 601 for (len = 0; buf[len] != '\0'; ++len);
Roland McGrath 2014/12/08 20:56:48 Why is it safe to presume it's terminated and not
Sam Clegg 2014/12/08 21:10:29 Because the __nacl_irt_getcwd will fail if it coul
Sam Clegg 2014/12/08 22:38:39 Ok. Done. Although in the case when __nacl_irt_ge
602 return len; 602 return len + 1;
603 } 603 }
604 604
605 __extern_always_inline gid_t 605 __extern_always_inline gid_t
606 INTERNAL_SYSCALL_getegid_0 (int *err) 606 INTERNAL_SYSCALL_getegid_0 (int *err)
607 { 607 {
608 *err = (38 /* ENOSYS */); 608 *err = (38 /* ENOSYS */);
609 return 0; 609 return 0;
610 } 610 }
611 611
612 __extern_always_inline uid_t 612 __extern_always_inline uid_t
(...skipping 1642 matching lines...) Expand 10 before | Expand all | Expand 10 after
2255 #define PSEUDO_END_ERRVAL(name) \ 2255 #define PSEUDO_END_ERRVAL(name) \
2256 END (name) 2256 END (name)
2257 2257
2258 #undef SYSCALL_ERROR_HANDLER_TLS_STORE 2258 #undef SYSCALL_ERROR_HANDLER_TLS_STORE
2259 #define SYSCALL_ERROR_HANDLER_TLS_STORE(src, destoff) \ 2259 #define SYSCALL_ERROR_HANDLER_TLS_STORE(src, destoff) \
2260 movl %gs:0, %eax; \ 2260 movl %gs:0, %eax; \
2261 movl src, (%eax,destoff) 2261 movl src, (%eax,destoff)
2262 2262
2263 #endif 2263 #endif
2264 #endif 2264 #endif
OLDNEW
« 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