Skip to content

Commit cdecfa6

Browse files
committed
openssh-6.7p1-coverity
1 parent 4f4dbab commit cdecfa6

10 files changed

Lines changed: 22 additions & 11 deletions

File tree

gss-genr.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,9 @@ ssh_gssapi_kex_mechs(gss_OID_set gss_supported, ssh_gssapi_check_fn *check,
178178
enclen = __b64_ntop(digest,
179179
ssh_digest_bytes(SSH_DIGEST_MD5), encoded,
180180
ssh_digest_bytes(SSH_DIGEST_MD5) * 2);
181-
181+
#pragma GCC diagnostic ignored "-Wstringop-overflow"
182182
cp = strncpy(s, kex, strlen(kex));
183+
#pragma GCC diagnostic pop
183184
for ((p = strsep(&cp, ",")); p && *p != '\0';
184185
(p = strsep(&cp, ","))) {
185186
if (sshbuf_len(buf) != 0 &&

krl.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,6 +1202,7 @@ is_key_revoked(struct ssh_krl *krl, const struct sshkey *key)
12021202
return r;
12031203
erb = RB_FIND(revoked_blob_tree, &krl->revoked_sha1s, &rb);
12041204
free(rb.blob);
1205+
rb.blob = NULL; /* make coverity happy */
12051206
if (erb != NULL) {
12061207
KRL_DBG(("revoked by key SHA1"));
12071208
return SSH_ERR_KEY_REVOKED;
@@ -1212,6 +1213,7 @@ is_key_revoked(struct ssh_krl *krl, const struct sshkey *key)
12121213
return r;
12131214
erb = RB_FIND(revoked_blob_tree, &krl->revoked_sha256s, &rb);
12141215
free(rb.blob);
1216+
rb.blob = NULL; /* make coverity happy */
12151217
if (erb != NULL) {
12161218
KRL_DBG(("revoked by key SHA256"));
12171219
return SSH_ERR_KEY_REVOKED;
@@ -1223,6 +1225,7 @@ is_key_revoked(struct ssh_krl *krl, const struct sshkey *key)
12231225
return r;
12241226
erb = RB_FIND(revoked_blob_tree, &krl->revoked_keys, &rb);
12251227
free(rb.blob);
1228+
rb.blob = NULL; /* make coverity happy */
12261229
if (erb != NULL) {
12271230
KRL_DBG(("revoked by explicit key"));
12281231
return SSH_ERR_KEY_REVOKED;

loginrec.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,9 +680,11 @@ construct_utmp(struct logininfo *li,
680680
*/
681681

682682
/* Use strncpy because we don't necessarily want null termination */
683+
/* coverity[buffer_size_warning : FALSE] */
683684
strncpy(ut->ut_name, li->username,
684685
MIN_SIZEOF(ut->ut_name, li->username));
685686
# ifdef HAVE_HOST_IN_UTMP
687+
/* coverity[buffer_size_warning : FALSE] */
686688
strncpy(ut->ut_host, li->hostname,
687689
MIN_SIZEOF(ut->ut_host, li->hostname));
688690
# endif

misc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1620,6 +1620,8 @@ sanitise_stdfd(void)
16201620
}
16211621
if (nullfd > STDERR_FILENO)
16221622
close(nullfd);
1623+
/* coverity[leaked_handle : FALSE]*/
1624+
/* coverity[leaked_handle : FALSE]*/
16231625
}
16241626

16251627
char *
@@ -2823,6 +2825,7 @@ stdfd_devnull(int do_stdin, int do_stdout, int do_stderr)
28232825
}
28242826
if (devnull > STDERR_FILENO)
28252827
close(devnull);
2828+
/* coverity[leaked_handle : FALSE]*/
28262829
return ret;
28272830
}
28282831

monitor.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ monitor_child_preauth(struct ssh *ssh, struct monitor *pmonitor)
410410
mm_get_keystate(ssh, pmonitor);
411411

412412
/* Drain any buffered messages from the child */
413-
while (pmonitor->m_log_recvfd != -1 && monitor_read_log(pmonitor) == 0)
413+
while (pmonitor->m_log_recvfd >= 0 && monitor_read_log(pmonitor) == 0)
414414
;
415415

416416
/* Wait for the child's exit status */
@@ -1829,7 +1829,7 @@ mm_answer_pty(struct ssh *ssh, int sock, struct sshbuf *m)
18291829
s->ptymaster = s->ptyfd;
18301830

18311831
debug3_f("tty %s ptyfd %d", s->tty, s->ttyfd);
1832-
1832+
/* coverity[leaked_handle : FALSE] */
18331833
return (0);
18341834

18351835
error:

openbsd-compat/bindresvport.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ bindresvport_sa(int sd, struct sockaddr *sa)
5959
struct sockaddr_in6 *in6;
6060
u_int16_t *portp;
6161
u_int16_t port;
62-
socklen_t salen;
62+
socklen_t salen = sizeof(struct sockaddr_storage);
6363
int i;
6464

6565
if (sa == NULL) {

openbsd-compat/bsd-pselect.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,22 +85,22 @@ pselect_notify_setup(void)
8585
static void
8686
pselect_notify_parent(void)
8787
{
88-
if (notify_pipe[1] != -1)
88+
if (notify_pipe[1] >= 0)
8989
(void)write(notify_pipe[1], "", 1);
9090
}
9191
static void
9292
pselect_notify_prepare(fd_set *readset)
9393
{
94-
if (notify_pipe[0] != -1)
94+
if (notify_pipe[0] >= 0)
9595
FD_SET(notify_pipe[0], readset);
9696
}
9797
static void
9898
pselect_notify_done(fd_set *readset)
9999
{
100100
char c;
101101

102-
if (notify_pipe[0] != -1 && FD_ISSET(notify_pipe[0], readset)) {
103-
while (read(notify_pipe[0], &c, 1) != -1)
102+
if (notify_pipe[0] >= 0 && FD_ISSET(notify_pipe[0], readset)) {
103+
while (read(notify_pipe[0], &c, 1) >= 0)
104104
debug2_f("reading");
105105
FD_CLR(notify_pipe[0], readset);
106106
}

readconf.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2164,6 +2164,7 @@ process_config_line_depth(Options *options, struct passwd *pw, const char *host,
21642164
} else if (r != 0) {
21652165
error("%.200s line %d: glob failed for %s.",
21662166
filename, linenum, arg2);
2167+
free(arg2);
21672168
goto out;
21682169
}
21692170
free(arg2);

servconf.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2121,8 +2121,9 @@ process_server_config_line_depth(ServerOptions *options, char *line,
21212121
if (*activep && *charptr == NULL) {
21222122
*charptr = tilde_expand_filename(arg, getuid());
21232123
/* increase optional counter */
2124-
if (intptr != NULL)
2125-
*intptr = *intptr + 1;
2124+
/* DEAD CODE intptr is still NULL ;)
2125+
if (intptr != NULL)
2126+
*intptr = *intptr + 1; */
21262127
}
21272128
break;
21282129

serverloop.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ server_request_tun(struct ssh *ssh)
536536
debug_f("invalid tun");
537537
goto done;
538538
}
539-
if (auth_opts->force_tun_device != -1) {
539+
if (auth_opts->force_tun_device >= 0) {
540540
if (tun != SSH_TUNID_ANY &&
541541
auth_opts->force_tun_device != (int)tun)
542542
goto done;

0 commit comments

Comments
 (0)