]> andersk Git - openssh.git/blobdiff - ssh-rand-helper.c
fix spacing of include
[openssh.git] / ssh-rand-helper.c
index 03c58164c0f752bfbd41702cf6c0b5578005a3fa..d8517b1a32a7a0aae6d8840123392db2760ac7de 100644 (file)
@@ -123,7 +123,7 @@ get_random_bytes_prngd(unsigned char *buf, int len,
     unsigned short tcp_port, char *socket_path)
 {
        int fd, addr_len, rval, errors;
-       char msg[2];
+       u_char msg[2];
        struct sockaddr_storage addr;
        struct sockaddr_in *addr_in = (struct sockaddr_in *)&addr;
        struct sockaddr_un *addr_un = (struct sockaddr_un *)&addr;
@@ -135,8 +135,8 @@ get_random_bytes_prngd(unsigned char *buf, int len,
        if (socket_path != NULL &&
            strlen(socket_path) >= sizeof(addr_un->sun_path))
                fatal("Random pool path is too long");
-       if (len > 255)
-               fatal("Too many bytes to read from PRNGD");
+       if (len <= 0 || len > 255)
+               fatal("Too many bytes (%d) to read from PRNGD", len);
 
        memset(&addr, '\0', sizeof(addr));
 
@@ -190,7 +190,7 @@ reopen:
                goto done;
        }
 
-       if (atomicio(read, fd, buf, len) != len) {
+       if (atomicio(read, fd, buf, len) != (size_t)len) {
                if (errno == EPIPE && errors < 10) {
                        close(fd);
                        errors++;
@@ -398,8 +398,8 @@ hash_command_output(entropy_cmd_t *src, unsigned char *hash)
        debug3("Time elapsed: %d msec", msec_elapsed);
 
        if (waitpid(pid, &status, 0) == -1) {
-              error("Couldn't wait for child '%s' completion: %s",
-                  src->cmdstring, strerror(errno));
+               error("Couldn't wait for child '%s' completion: %s",
+                   src->cmdstring, strerror(errno));
                return 0.0;
        }
 
@@ -600,7 +600,7 @@ prng_write_seedfile(void)
                        save_errno = errno;
                        unlink(tmpseed);
                        fatal("problem renaming PRNG seedfile from %.100s "
-                           "to %.100s (%.100s)", tmpseed, filename, 
+                           "to %.100s (%.100s)", tmpseed, filename,
                            strerror(save_errno));
                }
        }
@@ -891,8 +891,8 @@ main(int argc, char **argv)
 
 /*
  * We may attempt to re-seed during mkstemp if we are using the one in the
- * compat library (via mkstemp -> arc4random -> seed_rng) so we need
- * our own seed_rng().  We must also check that we have enough entropy.
+ * compat library (via mkstemp -> _gettemp -> arc4random -> seed_rng) so we
+ * need our own seed_rng().  We must also check that we have enough entropy.
  */
 void
 seed_rng(void)
This page took 0.046235 seconds and 4 git commands to generate.