Bug 14229

Summary: strtok_r() doesn't work with x32
Product: glibc Reporter: Mike Frysinger <vapier>
Component: libcAssignee: H.J. Lu <hjl.tools>
Status: VERIFIED FIXED    
Severity: normal CC: drepper.fsp
Priority: P1 Flags: fweimer: security-
Version: 2.15   
Target Milestone: 2.16   
URL: http://sourceware.org/ml/libc-alpha/2012-06/msg00357.html
Host: Target: x86_64-linux-gnux32
Build: Last reconfirmed:

Description Mike Frysinger 2012-06-13 16:11:34 IST
tested the patched glibc-2.15 as well as the latest git mainline

$ cat test.c
#include <stdio.h>
#include <string.h>
int main() {
    char line[] = "udf 75868 1 - Live 0xffffffffa0bfb000\n";
    char *saveptr, *tok = strtok_r(line, " \t", &saveptr);
    printf("tok: {%s}\nshould be: {udf}\n", tok);
    return 0;
}

$ gcc -Wall test.c -m64 && ./a.out
tok: {udf}
should be: {udf}

$ gcc -Wall test.c -m32 && ./a.out
tok: {udf}
should be: {udf}

$ gcc -Wall test.c -mx32 && ./a.out
tok: {}
should be: {udf}
Comment 1 H.J. Lu 2012-06-13 17:40:59 IST
A patch is posted at

http://sourceware.org/ml/libc-alpha/2012-06/msg00357.html
Comment 2 H.J. Lu 2012-06-14 17:42:45 IST
Fixed on master branch and hjl/x32/release/2.15 branch.
Comment 3 Mike Frysinger 2012-06-14 18:31:29 IST
works great!

# lsmod
Module                  Size  Used by
udf                    75868  0
usb_storage            35339  1
dm_mod                 63508  0
xt_tcpudp               2311  2
iptable_filter          1120  1