- djm@cvs.openbsd.org 2004/05/09 01:26:48
[kex.c]
don't overwrite what we are trying to compute
+ - deraadt@cvs.openbsd.org 2004/05/11 19:01:43
+ [auth.c auth2-none.c authfile.c channels.c monitor.c monitor_mm.c
+ packet.c packet.h progressmeter.c session.c openbsd-compat/xmmap.c]
+ improve some code lint did not like; djm millert ok
20040502
- (dtucker) OpenBSD CVS Sync
*/
#include "includes.h"
-RCSID("$OpenBSD: auth.c,v 1.52 2004/05/08 00:01:37 deraadt Exp $");
+RCSID("$OpenBSD: auth.c,v 1.53 2004/05/11 19:01:43 deraadt Exp $");
#ifdef HAVE_LOGIN_H
#include <login.h>
fake.pw_passwd =
"$2a$06$r3.juUaHZDlIbQaO2dS9FuYxL1W9M81R1Tc92PoSNmzvpEqLkLGrK";
fake.pw_gecos = "NOUSER";
- fake.pw_uid = -1;
- fake.pw_gid = -1;
+ fake.pw_uid = (uid_t)-1;
+ fake.pw_gid = (gid_t)-1;
#ifdef HAVE_PW_CLASS_IN_PASSWD
fake.pw_class = "";
#endif
*/
#include "includes.h"
-RCSID("$OpenBSD: auth2-none.c,v 1.6 2003/08/26 09:58:43 markus Exp $");
+RCSID("$OpenBSD: auth2-none.c,v 1.7 2004/05/11 19:01:43 deraadt Exp $");
#include "auth.h"
#include "xmalloc.h"
{
struct stat st;
char *banner = NULL;
- off_t len, n;
+ size_t len, n;
int fd;
if ((fd = open(options.banner, O_RDONLY)) == -1)
close(fd);
return (NULL);
}
- len = st.st_size;
+ if (st.st_size > 1*1024*1024) {
+ close(fd);
+ return (NULL);
+ }
+
+ len = (size_t)st.st_size; /* truncate */
banner = xmalloc(len + 1);
n = atomicio(read, fd, banner, len);
close(fd);
*/
#include "includes.h"
-RCSID("$OpenBSD: authfile.c,v 1.55 2003/09/18 07:56:05 markus Exp $");
+RCSID("$OpenBSD: authfile.c,v 1.56 2004/05/11 19:01:43 deraadt Exp $");
#include <openssl/err.h>
#include <openssl/evp.h>
struct stat st;
char *cp;
int i;
- off_t len;
+ size_t len;
if (fstat(fd, &st) < 0) {
error("fstat for key file %.200s failed: %.100s",
filename, strerror(errno));
return NULL;
}
- len = st.st_size;
+ if (st.st_size > 1*1024*1024)
+ close(fd);
+ len = (size_t)st.st_size; /* truncated */
buffer_init(&buffer);
cp = buffer_append_space(&buffer, len);
char **commentp)
{
int i, check1, check2, cipher_type;
- off_t len;
+ size_t len;
Buffer buffer, decrypted;
u_char *cp;
CipherContext ciphercontext;
close(fd);
return NULL;
}
- len = st.st_size;
+ if (st.st_size > 1*1024*1024) {
+ close(fd);
+ return (NULL);
+ }
+ len = (size_t)st.st_size; /* truncated */
buffer_init(&buffer);
cp = buffer_append_space(&buffer, len);
*/
#include "includes.h"
-RCSID("$OpenBSD: channels.c,v 1.200 2004/01/19 09:24:21 markus Exp $");
+RCSID("$OpenBSD: channels.c,v 1.201 2004/05/11 19:01:43 deraadt Exp $");
#include "ssh.h"
#include "ssh1.h"
buffer_get(&c->input, (char *)&dest_port, 2);
dest_addr[addrlen] = '\0';
if (s5_req.atyp == SSH_SOCKS5_DOMAIN)
- strlcpy(c->path, dest_addr, sizeof(c->path));
+ strlcpy(c->path, (char *)dest_addr, sizeof(c->path));
else if (inet_ntop(af, dest_addr, c->path, sizeof(c->path)) == NULL)
return -1;
c->host_port = ntohs(dest_port);
*/
#include "includes.h"
-RCSID("$OpenBSD: monitor.c,v 1.56 2004/05/09 01:19:27 djm Exp $");
+RCSID("$OpenBSD: monitor.c,v 1.57 2004/05/11 19:01:43 deraadt Exp $");
#include <openssl/dh.h>
res = WIFEXITED(status) ? WEXITSTATUS(status) : 1;
/* Terminate process */
- exit (res);
+ exit(res);
}
void
*/
#include "includes.h"
-RCSID("$OpenBSD: monitor_mm.c,v 1.8 2002/08/02 14:43:15 millert Exp $");
+RCSID("$OpenBSD: monitor_mm.c,v 1.9 2004/05/11 19:01:43 deraadt Exp $");
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
#ifdef HAVE_MMAP
# ifdef MAP_ANON
address = mmap(NULL, size, PROT_WRITE|PROT_READ, MAP_ANON|MAP_SHARED,
- -1, 0);
+ -1, (off_t)0);
# else
address = mmap(NULL, size, PROT_WRITE|PROT_READ, MAP_SHARED,
- open("/dev/zero", O_RDWR), 0);
+ open("/dev/zero", O_RDWR), (off_t)0);
# endif
#define MM_SWAP_TEMPLATE "/var/run/sshd.mm.XXXXXXXX"
unlink(tmpname);
ftruncate(tmpfd, size);
address = mmap(NULL, size, PROT_WRITE|PROT_READ, MAP_SHARED,
- tmpfd, 0);
+ tmpfd, (off_t)0);
close(tmpfd);
}
*/
#include "includes.h"
-RCSID("$OpenBSD: packet.c,v 1.112 2003/09/23 20:17:11 markus Exp $");
+RCSID("$OpenBSD: packet.c,v 1.113 2004/05/11 19:01:43 deraadt Exp $");
#include "openbsd-compat/sys-queue.h"
fatal("packet_set_connection: cannot load cipher 'none'");
connection_in = fd_in;
connection_out = fd_out;
- cipher_init(&send_context, none, "", 0, NULL, 0, CIPHER_ENCRYPT);
- cipher_init(&receive_context, none, "", 0, NULL, 0, CIPHER_DECRYPT);
+ cipher_init(&send_context, none, (const u_char *)"",
+ 0, NULL, 0, CIPHER_ENCRYPT);
+ cipher_init(&receive_context, none, (const u_char *)"",
+ 0, NULL, 0, CIPHER_DECRYPT);
newkeys[MODE_IN] = newkeys[MODE_OUT] = NULL;
if (!initialized) {
initialized = 1;
return interactive_mode;
}
-u_int
+int
packet_set_maxsize(u_int s)
{
static int called = 0;
}
}
-#define MAX_PACKETS (1<<31)
+#define MAX_PACKETS (1U<<31)
int
packet_need_rekeying(void)
{
-/* $OpenBSD: packet.h,v 1.40 2003/06/24 08:23:46 markus Exp $ */
+/* $OpenBSD: packet.h,v 1.41 2004/05/11 19:01:43 deraadt Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
void tty_parse_modes(int, int *);
extern u_int max_packet_size;
-u_int packet_set_maxsize(u_int);
+int packet_set_maxsize(u_int);
#define packet_get_maxsize() max_packet_size
/* don't allow remaining bytes after the end of the message */
*/
#include "includes.h"
-RCSID("$OpenBSD: progressmeter.c,v 1.19 2004/02/05 15:33:33 markus Exp $");
+RCSID("$OpenBSD: progressmeter.c,v 1.20 2004/05/11 19:01:43 deraadt Exp $");
#include "progressmeter.h"
#include "atomicio.h"
/* bandwidth usage */
format_rate(buf + strlen(buf), win_size - strlen(buf),
- bytes_per_second);
+ (off_t)bytes_per_second);
strlcat(buf, "/s ", win_size);
/* ETA */
*/
#include "includes.h"
-RCSID("$OpenBSD: session.c,v 1.174 2004/05/09 01:19:28 djm Exp $");
+RCSID("$OpenBSD: session.c,v 1.175 2004/05/11 19:01:43 deraadt Exp $");
#include "ssh.h"
#include "ssh1.h"
static int
session_break_req(Session *s)
{
- u_int break_length;
- break_length = packet_get_int(); /* ignored */
+ packet_get_int(); /* ignored */
packet_check_eom();
if (s->ttyfd == -1 ||