Wireless Daemon for Linux
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.01.org
Subject: [PATCH 1/4] util: add bounds check to util_get_{domain,username}
Date: Wed, 16 Oct 2019 16:43:01 -0700	[thread overview]
Message-ID: <20191016234304.14716-1-prestwoj@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 773 bytes --]

---
 src/util.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/util.c b/src/util.c
index f787ce6b..f1860a33 100644
--- a/src/util.c
+++ b/src/util.c
@@ -176,7 +176,7 @@ const char *util_get_domain(const char *identity)
 			strncpy(domain, identity, c - identity);
 			return domain;
 		case '@':
-			strcpy(domain, c + 1);
+			strncpy(domain, c + 1, sizeof(domain));
 			return domain;
 		default:
 			continue;
@@ -197,7 +197,7 @@ const char *util_get_username(const char *identity)
 	for (c = identity; *c; c++) {
 		switch (*c) {
 		case '\\':
-			strcpy(username, c + 1);
+			strncpy(username, c + 1, sizeof(username));
 			return username;
 		case '@':
 			strncpy(username, identity, c - identity);
-- 
2.17.1

             reply	other threads:[~2019-10-16 23:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-16 23:43 James Prestwood [this message]
2019-10-16 23:43 ` [PATCH 2/4] eapol: reorder eapol_sm_free James Prestwood
2019-10-17  2:18   ` Denis Kenzior
2019-10-16 23:43 ` [PATCH 3/4] eapol: check return of ie_parse_rsne_from_data James Prestwood
2019-10-17  2:25   ` Denis Kenzior
2019-10-16 23:43 ` [PATCH 4/4] ie: reorder ie_parse_osen to fix uninitialized value James Prestwood
2019-10-17  2:25   ` Denis Kenzior
2019-10-17  2:15 ` [PATCH 1/4] util: add bounds check to util_get_{domain,username} Denis Kenzior

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=20191016234304.14716-1-prestwoj@gmail.com \
    --to=prestwoj@gmail.com \
    --cc=iwd@lists.01.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