ramosian-glider / memory-sanitizer

Automatically exported from code.google.com/p/memory-sanitizer
0 stars 0 forks source link

getlogin_r + strlen false positive #83

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The code:

#include <unistd.h>
#include <stdio.h>
#include <string.h>
int main()
{
    char buf[20];
    getlogin_r(buf,20);
    printf("%s %lu\n", buf, strlen(buf));
    return 0;
}

Produces 
Uninitialized bytes in __interceptor_strlen at offset 0 inside [0x7fffadd55e40, 
8)
==1510== WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x7fac569fbf0a in main (/home/rschulz/work/msan/a.out+0x90f0a)
    #1 0x7fac55880b04 in __libc_start_main (/lib64/libc.so.6+0x21b04)
    #2 0x7fac569a6a5e in _start /home/abuild/rpmbuild/BUILD/glibc-2.19/csu/../sysdeps/x86_64/start.S:112

  Uninitialized value was created by an allocation of 'buf' in the stack frame of function 'main'
    #0 0x7fac569fbe70 in main (/home/rschulz/work/msan/a.out+0x90e70)

This is with both clang 3.5.0 and 3.6.0rc1.

Original issue reported on code.google.com by rol...@rschulz.eu on 27 Jan 2015 at 8:10

GoogleCodeExporter commented 9 years ago
Missing an interceptor for getlogin_r().

Original comment by euge...@google.com on 27 Jan 2015 at 10:24

GoogleCodeExporter commented 9 years ago
Adding Project:MemorySanitizer as part of GitHub migration.

Original comment by gli...@google.com on 30 Jul 2015 at 9:22