]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream: consistently use NULL for null pointer constants found
authorjsg@openbsd.org <jsg@openbsd.org>
Thu, 25 Sep 2025 06:23:19 +0000 (06:23 +0000)
committerDamien Miller <djm@mindrot.org>
Thu, 25 Sep 2025 07:01:40 +0000 (17:01 +1000)
with sparse, ok djm@

OpenBSD-Commit-ID: 1067504b63732d809d0d57ad4bc626818d112772

channels.c
clientloop.c
scp.c
serverloop.c
sftp.c
ssh-pkcs11.c
sshconnect.c
sshsig.c

index aeb0d41d6c22aa39f64ccdbbd29aa81c44179e90..ed852beb09cc3a7b0332737eef2d04e5893cd749 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: channels.c,v 1.449 2025/09/15 04:39:58 djm Exp $ */
+/* $OpenBSD: channels.c,v 1.450 2025/09/25 06:23:19 jsg Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -4565,7 +4565,7 @@ channel_add_permission(struct ssh *ssh, int who, int where,
         * host/port_to_connect.
         */
        permission_set_add(ssh, who, where,
-           local ? host : 0, local ? port : 0,
+           local ? host : NULL, local ? port : 0,
            local ? NULL : host, NULL, local ? 0 : port, NULL);
        pset->all_permitted = 0;
 }
index a2f7578679017fa608f5dfeaca2b36a206c1f930..49d048d85a4fdb644f7162a3330af8d3810c2f0a 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: clientloop.c,v 1.414 2025/08/18 03:43:01 djm Exp $ */
+/* $OpenBSD: clientloop.c,v 1.415 2025/09/25 06:23:19 jsg Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1868,7 +1868,7 @@ client_request_tun_fwd(struct ssh *ssh, int tun_mode,
        char *ifname = NULL;
 
        if (tun_mode == SSH_TUNMODE_NO)
-               return 0;
+               return NULL;
 
        debug("Requesting tun unit %d in mode %d", local_tun, tun_mode);
 
diff --git a/scp.c b/scp.c
index c19f57c69168d54500152cf26f4390b2d251b031..c5f573cc1fde02875c079dc7dfd28671e095a6b4 100644 (file)
--- a/scp.c
+++ b/scp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scp.c,v 1.267 2025/09/24 00:51:28 jsg Exp $ */
+/* $OpenBSD: scp.c,v 1.268 2025/09/25 06:23:19 jsg Exp $ */
 /*
  * scp - secure remote copy.  This is basically patched BSD rcp which
  * uses ssh to do the data transfer (instead of using rcmd).
@@ -1572,7 +1572,7 @@ sink_sftp(int argc, char *dst, const char *src, struct sftp_conn *conn)
        }
 
        /* Did we actually get any matches back from the glob? */
-       if (g.gl_matchc == 0 && g.gl_pathc == 1 && g.gl_pathv[0] != 0) {
+       if (g.gl_matchc == 0 && g.gl_pathc == 1 && g.gl_pathv[0] != NULL) {
                /*
                 * If nothing matched but a path returned, then it's probably
                 * a GLOB_NOCHECK result. Check whether the unglobbed path
@@ -2013,7 +2013,7 @@ throughlocal_sftp(struct sftp_conn *from, struct sftp_conn *to,
        }
 
        /* Did we actually get any matches back from the glob? */
-       if (g.gl_matchc == 0 && g.gl_pathc == 1 && g.gl_pathv[0] != 0) {
+       if (g.gl_matchc == 0 && g.gl_pathc == 1 && g.gl_pathv[0] != NULL) {
                /*
                 * If nothing matched but a path returned, then it's probably
                 * a GLOB_NOCHECK result. Check whether the unglobbed path
@@ -2223,7 +2223,7 @@ allocbuf(BUF *bp, int fd, int blksize)
 
        if (fstat(fd, &stb) == -1) {
                run_err("fstat: %s", strerror(errno));
-               return (0);
+               return (NULL);
        }
        size = ROUNDUP(stb.st_blksize, blksize);
        if (size == 0)
index c8b1fd6db73832a4baf31dcac980680caf908f31..5d3b194d128f643ec7ccfb69cf9e91e52b08477a 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: serverloop.c,v 1.243 2025/08/18 03:43:01 djm Exp $ */
+/* $OpenBSD: serverloop.c,v 1.244 2025/09/25 06:23:19 jsg Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -672,7 +672,7 @@ server_input_hostkeys_prove(struct ssh *ssh, struct sshbuf **respp)
        int r, ndx, success = 0;
        const u_char *blob;
        const char *sigalg, *kex_rsa_sigalg = NULL;
-       u_char *sig = 0;
+       u_char *sig = NULL;
        size_t blen, slen;
 
        if ((resp = sshbuf_new()) == NULL || (sigbuf = sshbuf_new()) == NULL)
diff --git a/sftp.c b/sftp.c
index ff85ab507695cdff57f5cb3de0147a5b87e6d2b9..c77a608a8e543629cf3b7566910f7c45d0dee0c5 100644 (file)
--- a/sftp.c
+++ b/sftp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp.c,v 1.242 2025/09/15 04:49:00 djm Exp $ */
+/* $OpenBSD: sftp.c,v 1.243 2025/09/25 06:23:19 jsg Exp $ */
 /*
  * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
  *
@@ -2656,7 +2656,7 @@ main(int argc, char **argv)
        } else {
                if ((r = argv_split(sftp_direct, &tmp, &cpp, 1)) != 0)
                        fatal_r(r, "Parse -D arguments");
-               if (cpp[0] == 0)
+               if (cpp[0] == NULL)
                        fatal("No sftp server specified via -D");
                connect_to_server(cpp[0], cpp, &in, &out);
                argv_free(cpp, tmp);
index 809910e97f0186b4ba70de8260d67f2524cb4608..36b428223f368cd207d7683f281f6b2872e94d01 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-pkcs11.c,v 1.70 2025/09/24 00:51:28 jsg Exp $ */
+/* $OpenBSD: ssh-pkcs11.c,v 1.71 2025/09/25 06:23:19 jsg Exp $ */
 /*
  * Copyright (c) 2010 Markus Friedl.  All rights reserved.
  * Copyright (c) 2014 Pedro Martelletto. All rights reserved.
@@ -552,7 +552,7 @@ pkcs11_sign_rsa(struct sshkey *key,
        const u_char            *oid;
 
        if (sigp != NULL)
-               *sigp = 0;
+               *sigp = NULL;
        if (lenp != NULL)
                *lenp = 0;
 
@@ -642,7 +642,7 @@ pkcs11_sign_ecdsa(struct sshkey *key,
        int                     hashalg, ret = -1, r, siglen;
 
        if (sigp != NULL)
-               *sigp = 0;
+               *sigp = NULL;
        if (lenp != NULL)
                *lenp = 0;
 
@@ -727,7 +727,7 @@ pkcs11_sign_ed25519(struct sshkey *key,
        int                     ret = -1;
 
        if (sigp != NULL)
-               *sigp = 0;
+               *sigp = NULL;
        if (lenp != NULL)
                *lenp = 0;
 
index 0f260a2cd14bf9f67404c2764190822b6f8eb4f0..912a520c51bfdf8a9a856c05019028a53a1a89f8 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshconnect.c,v 1.375 2025/09/15 04:49:41 djm Exp $ */
+/* $OpenBSD: sshconnect.c,v 1.376 2025/09/25 06:23:19 jsg Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -789,7 +789,7 @@ hostkeys_find_by_key(const char *host, const char *ip, const struct sshkey *key,
     char **system_hostfiles, u_int num_system_hostfiles,
     char ***names, u_int *nnames)
 {
-       struct find_by_key_ctx ctx = {0, 0, 0, 0, 0};
+       struct find_by_key_ctx ctx = {NULL, NULL, NULL, NULL, 0};
        u_int i;
 
        *names = NULL;
index d84004ca961f233356595e594e704c530d34dd0e..3789c437baa05c50ecb6c83981d1db77f0fd7b5e 100644 (file)
--- a/sshsig.c
+++ b/sshsig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshsig.c,v 1.39 2025/09/15 04:52:41 djm Exp $ */
+/* $OpenBSD: sshsig.c,v 1.40 2025/09/25 06:23:19 jsg Exp $ */
 /*
  * Copyright (c) 2019 Google LLC
  *
@@ -1128,7 +1128,7 @@ sshsig_match_principals(const char *path, const char *principal,
        if (ret == 0) {
                if (nprincipals == 0)
                        ret = SSH_ERR_KEY_NOT_FOUND;
-               if (nprincipalsp != 0)
+               if (nprincipalsp != NULL)
                        *nprincipalsp = nprincipals;
                if (principalsp != NULL) {
                        *principalsp = principals;