Skip to content

Commit 5c2f3b7

Browse files
committed
openssh-6.7p1-coverity
1 parent 82b2baa commit 5c2f3b7

11 files changed

Lines changed: 24 additions & 11 deletions

File tree

auth-krb5.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,13 +427,15 @@ ssh_krb5_cc_new_unique(krb5_context ctx, krb5_ccache *ccache, int *need_environm
427427
umask(old_umask);
428428
if (tmpfd == -1) {
429429
logit("mkstemp(): %.100s", strerror(oerrno));
430+
free(ccname);
430431
return oerrno;
431432
}
432433

433434
if (fchmod(tmpfd,S_IRUSR | S_IWUSR) == -1) {
434435
oerrno = errno;
435436
logit("fchmod(): %.100s", strerror(oerrno));
436437
close(tmpfd);
438+
free(ccname);
437439
return oerrno;
438440
}
439441
/* make sure the KRB5CCNAME is set for non-standard location */

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
@@ -1205,6 +1205,7 @@ is_key_revoked(struct ssh_krl *krl, const struct sshkey *key)
12051205
return r;
12061206
erb = RB_FIND(revoked_blob_tree, &krl->revoked_sha1s, &rb);
12071207
free(rb.blob);
1208+
rb.blob = NULL; /* make coverity happy */
12081209
if (erb != NULL) {
12091210
KRL_DBG(("revoked by key SHA1"));
12101211
return SSH_ERR_KEY_REVOKED;
@@ -1215,6 +1216,7 @@ is_key_revoked(struct ssh_krl *krl, const struct sshkey *key)
12151216
return r;
12161217
erb = RB_FIND(revoked_blob_tree, &krl->revoked_sha256s, &rb);
12171218
free(rb.blob);
1219+
rb.blob = NULL; /* make coverity happy */
12181220
if (erb != NULL) {
12191221
KRL_DBG(("revoked by key SHA256"));
12201222
return SSH_ERR_KEY_REVOKED;
@@ -1226,6 +1228,7 @@ is_key_revoked(struct ssh_krl *krl, const struct sshkey *key)
12261228
return r;
12271229
erb = RB_FIND(revoked_blob_tree, &krl->revoked_keys, &rb);
12281230
free(rb.blob);
1231+
rb.blob = NULL; /* make coverity happy */
12291232
if (erb != NULL) {
12301233
KRL_DBG(("revoked by explicit key"));
12311234
return SSH_ERR_KEY_REVOKED;

loginrec.c

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

679679
/* Use strncpy because we don't necessarily want null termination */
680+
/* coverity[buffer_size_warning : FALSE] */
680681
strncpy(ut->ut_name, li->username,
681682
MIN_SIZEOF(ut->ut_name, li->username));
682683
# ifdef HAVE_HOST_IN_UTMP
684+
/* coverity[buffer_size_warning : FALSE] */
683685
strncpy(ut->ut_host, li->hostname,
684686
MIN_SIZEOF(ut->ut_host, li->hostname));
685687
# endif

misc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1573,6 +1573,8 @@ sanitise_stdfd(void)
15731573
}
15741574
if (nullfd > STDERR_FILENO)
15751575
close(nullfd);
1576+
/* coverity[leaked_handle : FALSE]*/
1577+
/* coverity[leaked_handle : FALSE]*/
15761578
}
15771579

15781580
char *
@@ -2773,6 +2775,7 @@ stdfd_devnull(int do_stdin, int do_stdout, int do_stderr)
27732775
}
27742776
if (devnull > STDERR_FILENO)
27752777
close(devnull);
2778+
/* coverity[leaked_handle : FALSE]*/
27762779
return ret;
27772780
}
27782781

monitor.c

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

407407
/* Drain any buffered messages from the child */
408-
while (pmonitor->m_log_recvfd != -1 && monitor_read_log(pmonitor) == 0)
408+
while (pmonitor->m_log_recvfd >= 0 && monitor_read_log(pmonitor) == 0)
409409
;
410410

411411
/* Wait for the child's exit status */
@@ -1819,7 +1819,7 @@ mm_answer_pty(struct ssh *ssh, int sock, struct sshbuf *m)
18191819
s->ptymaster = s->ptyfd;
18201820

18211821
debug3_f("tty %s ptyfd %d", s->tty, s->ttyfd);
1822-
1822+
/* coverity[leaked_handle : FALSE] */
18231823
return (0);
18241824

18251825
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
@@ -2170,6 +2170,7 @@ process_config_line_depth(Options *options, struct passwd *pw, const char *host,
21702170
} else if (r != 0) {
21712171
error("%.200s line %d: glob failed for %s.",
21722172
filename, linenum, arg2);
2173+
free(arg2);
21732174
goto out;
21742175
}
21752176
free(arg2);

servconf.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2307,8 +2307,9 @@ process_server_config_line_depth(ServerOptions *options, char *line,
23072307
if (*activep && *charptr == NULL) {
23082308
*charptr = tilde_expand_filename(arg, getuid());
23092309
/* increase optional counter */
2310-
if (intptr != NULL)
2311-
*intptr = *intptr + 1;
2310+
/* DEAD CODE intptr is still NULL ;)
2311+
if (intptr != NULL)
2312+
*intptr = *intptr + 1; */
23122313
}
23132314
break;
23142315

0 commit comments

Comments
 (0)