]> granicus.if.org Git - sudo/commitdiff
Don't do pointer arithmetic on void *
authorTodd C. Miller <Todd.Miller@courtesan.com>
Sun, 17 Apr 2005 05:18:24 +0000 (05:18 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Sun, 17 Apr 2005 05:18:24 +0000 (05:18 +0000)
Use int, not size_t/ssize_t for systrace lengths (since it uses int)

mon_systrace.c
mon_systrace.h

index b103c17c113934f0061e7acdcec843f6f76669bc..1c16eee8f14b84b7f8897e1bbb6255dee2f5ebd3 100644 (file)
@@ -200,8 +200,7 @@ systrace_attach(pid)
 
     /* handle systrace events until the child finishes */
     for (;;) {
-       nread = read(fd, &msg, sizeof(msg));
-       if (nread != sizeof(msg)) {
+       if ((nread = read(fd, &msg, sizeof(msg))) != sizeof(msg)) {
            if (dodetach) {
                detachall(fd);
                _exit(0);
@@ -453,9 +452,9 @@ static int
 systrace_read(fd, pid, addr, buf, bufsiz)
     int fd;
     pid_t pid;
-    void *addr;
+    char *addr;
     void *buf;
-    size_t bufsiz;
+    int bufsiz;
 {
     struct systrace_io io;
 
@@ -474,15 +473,15 @@ systrace_read(fd, pid, addr, buf, bufsiz)
  * handle a strio_len > the actual kernel buffer.  It might be nice
  * to pass a starting chunksize though.
  */
-static ssize_t
+static int
 read_string(fd, pid, addr, buf, bufsiz)
     int fd;
     pid_t pid;
-    void *addr;
+    char *addr;
     char *buf;
-    size_t bufsiz;
+    int bufsiz;
 {
-    size_t chunksiz = 32;
+    int chunksiz = 32;
     char *cp = buf, *ep;
 
     while (bufsiz >= chunksiz) {
@@ -537,9 +536,9 @@ static int
 systrace_write(fd, pid, addr, buf, len)
     int fd;
     pid_t pid;
-    void *addr;
+    char *addr;
     void *buf;
-    size_t len;
+    int len;
 {
     struct systrace_io io;
 
@@ -563,10 +562,9 @@ update_env(fd, pid, seqnr, askp)
     struct str_msg_ask *askp;
 {
     struct systrace_replace repl;
-    ssize_t len;
     char *envbuf[ARG_MAX / sizeof(char *)], **envp, **envep;
     char buf[ARG_MAX], *ap, *cp, *off, *envptrs[4], *offsets[4], *replace[4];
-    int n;
+    int len, n;
 
     /*
      * Iterate through the environment, copying the data pointers and
@@ -769,7 +767,7 @@ decode_args(fd, pid, askp)
     pid_t pid;
     struct str_msg_ask *askp;
 {
-    ssize_t len;
+    int len;
     char *off, *ap, *cp, *ep;
     static char pbuf[PATH_MAX], abuf[ARG_MAX];
 
index a28f7a3010cc16d62dcc51ec5fe5f8442076b05b..d49471ca3ded396c2d29ac188cf25025c9a41cd9 100644 (file)
@@ -30,13 +30,13 @@ static int decode_args              __P((int, pid_t, struct str_msg_ask *));
 static int set_policy          __P((int, struct childinfo *));
 static int switch_emulation    __P((int, struct str_message *));
 static int systrace_open       __P((void));
-static int systrace_read       __P((int, pid_t, void *, void *, size_t));
+static int systrace_read       __P((int, pid_t, char *, void *, int));
 #ifdef STRIOCINJECT
-static int systrace_write      __P((int, pid_t, void *, void *, size_t));
+static int systrace_write      __P((int, pid_t, char *, void *, int));
 static int update_env          __P((int, pid_t, u_int16_t, struct str_msg_ask *));
 #endif
 static schandler_t find_handler        __P((pid_t, int));
-static ssize_t read_string     __P((int, pid_t, void *, char *, size_t));
+static int read_string         __P((int, pid_t, char *, char *, int));
 static struct childinfo *find_child __P((pid_t));
 static void catchsig           __P((int));
 static void detachall          __P((int));