hail-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jim Meyering <jim@meyering.net>
To: Project Hail <hail-devel@vger.kernel.org>
Subject: [PATCH tabled 2/2] server/server.c: don't deref NULL on failed strdup
Date: Thu, 23 Sep 2010 10:59:59 +0200	[thread overview]
Message-ID: <87mxr8ygvk.fsf@meyering.net> (raw)

This first one is so small it barely deserved a commit.
The second fixes a bug.

From 8e6255aa5cddd7bd58d7e4dbd2ecc81f84c51ea2 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Thu, 23 Sep 2010 10:47:22 +0200
Subject: [PATCH tabled 1/2] server/server.c: use "sizeof s" rather than equivalent "64"


Signed-off-by: Jim Meyering <meyering@redhat.com>
---
 server/server.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/server/server.c b/server/server.c
index 3398026..a1af4f0 100644
--- a/server/server.c
+++ b/server/server.c
@@ -356,7 +356,7 @@ static int authcheck(struct http_req *req, char *extra_bucket,
 		if (rc != DB_NOTFOUND) {
 			char s[64];

-			snprintf(s, 64, "get user '%s'", user);
+			snprintf(s, sizeof s, "get user '%s'", user);
 			tdbrep.tdb.passwd->err(tdbrep.tdb.passwd, rc, s);
 		}
 	} else {
--
1.7.3.234.g7bba3


From cf1f535adee9d93769cac5754c108ea9dac8a5c2 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Thu, 23 Sep 2010 10:56:01 +0200
Subject: [PATCH tabled 2/2] server/server.c: don't deref NULL on failed strdup

Otherwise, hreq_sign(..., ..., NULL,...) would end up
calling strlen(NULL).

Signed-off-by: Jim Meyering <meyering@redhat.com>
---
 server/server.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/server/server.c b/server/server.c
index a1af4f0..87681a9 100644
--- a/server/server.c
+++ b/server/server.c
@@ -363,6 +363,10 @@ static int authcheck(struct http_req *req, char *extra_bucket,
 		pass = val.data;
 	}

+	if (!pass) {
+		goto err_cmp;
+	}
+
 	hreq_sign(req, extra_bucket, pass, b64sig);
 	free(pass);

--
1.7.3.234.g7bba3

                 reply	other threads:[~2010-09-23  8:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mxr8ygvk.fsf@meyering.net \
    --to=jim@meyering.net \
    --cc=hail-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).