Mercurial > dropbear
comparison packet.c @ 1641:a2bbc22ea1e6 coverity
merge coverity
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Thu, 21 Mar 2019 00:14:38 +0800 |
parents | c4bf28ccab97 |
children | 3a97f14c0235 |
comparison
equal
deleted
inserted
replaced
1610:96e4c9b2cc00 | 1641:a2bbc22ea1e6 |
---|---|
56 | 56 |
57 /* non-blocking function writing out a current encrypted packet */ | 57 /* non-blocking function writing out a current encrypted packet */ |
58 void write_packet() { | 58 void write_packet() { |
59 | 59 |
60 ssize_t written; | 60 ssize_t written; |
61 #ifdef HAVE_WRITEV | 61 #if defined(HAVE_WRITEV) && (defined(IOV_MAX) || defined(UIO_MAXIOV)) |
62 /* 50 is somewhat arbitrary */ | 62 /* 50 is somewhat arbitrary */ |
63 unsigned int iov_count = 50; | 63 unsigned int iov_count = 50; |
64 struct iovec iov[50]; | 64 struct iovec iov[50]; |
65 #else | 65 #else |
66 int len; | 66 int len; |
108 _Static_assert(0, "No fuzzing code for no-writev writes"); | 108 _Static_assert(0, "No fuzzing code for no-writev writes"); |
109 #endif | 109 #endif |
110 /* Get the next buffer in the queue of encrypted packets to write*/ | 110 /* Get the next buffer in the queue of encrypted packets to write*/ |
111 writebuf = (buffer*)examine(&ses.writequeue); | 111 writebuf = (buffer*)examine(&ses.writequeue); |
112 | 112 |
113 /* The last byte of the buffer is not to be transmitted, but is | |
114 * a cleartext packet_type indicator */ | |
115 len = writebuf->len - writebuf->pos; | 113 len = writebuf->len - writebuf->pos; |
116 dropbear_assert(len > 0); | 114 dropbear_assert(len > 0); |
117 /* Try to write as much as possible */ | 115 /* Try to write as much as possible */ |
118 written = write(ses.sock_out, buf_getptr(writebuf, len), len); | 116 written = write(ses.sock_out, buf_getptr(writebuf, len), len); |
119 | 117 |