This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/3036] New: mktemp fails to convert full template


glibc 2.3.6-3 on a Fedora Core 4 machine.
When using mktemp on a large template, only the last 6 digits are converted,
whereas the mktemp documentation hints that all Xs would be.

The resulting probabilities is 26**6 = 308915776, i.e. 2^28 < 26^6 < 2^29.
As far as I remember, anything below 2^80 is considered weak against brute force
attacks.

For convenience sake, here is a simplified code snippet that shows the issue:

s[lenghtOfTempName] = '\0'; /* works at right index */
s[0] = 't';
s[1] = 'e';
s[2] = 'm';
s[3] = 'p';
s[4] = '.';
memset(&s[5],'X',lenghtOfTempName-5);
printf("tmpnam_s template, length %d,  %s\n", strlen(s), s);
mktemp(s);
printf("tmpnam_s template, length %d,  %s\n", strlen(s), s);

With the following output:tmpnam_s template, length 254, 
temp.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
tmpnam_s template, length 254, 
temp.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX7d1cuZ

-- 
           Summary: mktemp fails to convert full template
           Product: glibc
           Version: 2.3.6
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: ma_laver at ciise dot concordia dot ca
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=3036

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]