From: Srinivasa Ds <srinivasa@in.ibm.com>
To: Paul Mackerras <paulus@samba.org>
Cc: linux-kernel@vger.kernel.org, ananth@in.ibm.com,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] Transparently handle <.symbol> lookup for kprobes
Date: Tue, 24 Apr 2007 12:14:26 +0530 [thread overview]
Message-ID: <462DA74A.6090702@in.ibm.com> (raw)
In-Reply-To: <17965.40145.647933.480761@cargo.ozlabs.ibm.com>
Paul Mackerras wrote:
> Srinivasa Ds writes:
>
>> + } else { \
>> + char dot_name[KSYM_NAME_LEN+1]; \
>> + dot_name[0] = '.'; \
>> + dot_name[1] = '\0'; \
>> + strncat(dot_name, name, KSYM_NAME_LEN); \
>
> Assuming the kernel strncat works like the userspace one does, there
> is a possibility that dot_name[] won't be properly null-terminated
> here. If strlen(name) >= KSYM_NAME_LEN-1, then strncat will set
> dot_name[KSYM_NAME_LEN-1] to something non-null and won't touch
> dot_name[KSYM_NAME_LEN].
Irrespective of length of the string, kernel implementation of
strncat(lib/string.c) ensures that last character of string is set to
null. So dot_name[] is always null terminated.
========================
char *strncat(char *dest, const char *src, size_t count)
{
char *tmp = dest;
if (count) {
while (*dest)
dest++;
while ((*dest++ = *src++) != 0) {
if (--count == 0) {
*dest = '\0';
break;
}
}
}
return tmp;
}
EXPORT_SYMBOL(strncat);
===============================
Is this OK then ??
Thanks
Srinivasa DS
>
> Paul.
prev parent reply other threads:[~2007-04-24 6:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-23 5:58 [PATCH] Transparently handle <.symbol> lookup for kprobes Srinivasa Ds
2007-04-24 5:59 ` Paul Mackerras
2007-04-24 6:44 ` Srinivasa Ds [this message]
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=462DA74A.6090702@in.ibm.com \
--to=srinivasa@in.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=ananth@in.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paulus@samba.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.