From: Neil Horman <nhorman@tuxdriver.com>
To: linux-numa@vger.kernel.org
Cc: clalance@redhat.com, nhorman@tuxdriver.com
Subject: [PATCH] libnuma: fix obo error in set_thread_constraints
Date: Mon, 10 Aug 2009 07:12:19 -0400 [thread overview]
Message-ID: <20090810111219.GA13549@hmsreliant.think-freely.org> (raw)
Hey all-
Patch to fix an obo error in set_thread_constraints. nodes_alowed_list
gets allocated to be exactly the length needed, But since theres a newline in
the buffer array, we only copy 2 bytes, and fail to copy the the last character,
so we fail to terminate the string in nodes_allowed_list. As such we can't use
strlen on nodes_allowed_list safely. Instead compute the end of the string using
buffer.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
diff -up numactl-2.0.3/libnuma.c.orig numactl-2.0.3/libnuma.c
--- numactl-2.0.3/libnuma.c.orig 2009-08-10 07:02:12.000000000 -0400
+++ numactl-2.0.3/libnuma.c 2009-08-10 07:02:39.000000000 -0400
@@ -464,7 +464,7 @@ set_thread_constraints(void)
nodes_allowed_list = malloc(strlen(buffer)-18);
strncpy(nodes_allowed_list, buffer + 19,
strlen(buffer) - 19);
- nodes_allowed_list[strlen(nodes_allowed_list)-1] = '\0';
+ nodes_allowed_list[strlen(buffer)-19] = '\0';
}
}
fclose(f);
reply other threads:[~2009-08-10 11:12 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=20090810111219.GA13549@hmsreliant.think-freely.org \
--to=nhorman@tuxdriver.com \
--cc=clalance@redhat.com \
--cc=linux-numa@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).