summaryrefslogtreecommitdiffstats
path: root/usr.bin/truss
diff options
context:
space:
mode:
authordwmalone <dwmalone@FreeBSD.org>2002-04-21 19:04:26 +0000
committerdwmalone <dwmalone@FreeBSD.org>2002-04-21 19:04:26 +0000
commit4c92f1efeac78d6b5032c5ef85d0a4c4e7e81d8c (patch)
tree65933527a9e25b3f4a0469eba02b1cbea1d0e8cf /usr.bin/truss
parentb30303358f2986ce95ab22237d7a5ada7eeaac87 (diff)
downloadFreeBSD-src-4c92f1efeac78d6b5032c5ef85d0a4c4e7e81d8c.zip
FreeBSD-src-4c92f1efeac78d6b5032c5ef85d0a4c4e7e81d8c.tar.gz
Use fseeko and uintptr_t to make sure that we get a sensible offset
when trying to read from the stack. PR: 37104 Submitted by: Thomas Quinot <thomas@cuivre.fr.eu.org> MFC after: 3 weeks
Diffstat (limited to 'usr.bin/truss')
-rw-r--r--usr.bin/truss/syscalls.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c
index 47b0a4b..6cd8d0d 100644
--- a/usr.bin/truss/syscalls.c
+++ b/usr.bin/truss/syscalls.c
@@ -137,7 +137,7 @@ get_struct(int procfd, void *offset, void *buf, int len) {
err(1, "dup");
if ((p = fdopen(fd, "r")) == NULL)
err(1, "fdopen");
- fseek(p, (long)offset, SEEK_SET);
+ fseeko(p, (uintptr_t)offset, SEEK_SET);
for (pos = (char *)buf; len--; pos++) {
if ((c = fgetc(p)) == EOF)
return -1;
@@ -167,7 +167,7 @@ get_string(int procfd, void *offset, int max) {
buf = malloc( size = (max ? max : 64 ) );
len = 0;
buf[0] = 0;
- fseek(p, (long)offset, SEEK_SET);
+ fseeko(p, (uintptr_t)offset, SEEK_SET);
while ((c = fgetc(p)) != EOF) {
buf[len++] = c;
if (c == 0 || len == max) {
OpenPOWER on IntegriCloud