lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <462DA74A.6090702@in.ibm.com>
Date:	Tue, 24 Apr 2007 12:14:26 +0530
From:	Srinivasa Ds <srinivasa@...ibm.com>
To:	Paul Mackerras <paulus@...ba.org>
CC:	linux-kernel@...r.kernel.org, ananth@...ibm.com,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] Transparently handle <.symbol> lookup for kprobes

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.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ