RESOLVED FIXED 45412
Fix a problem in createCanonicalUUIDString that causes the last digit missing on Linux
https://bugs.webkit.org/show_bug.cgi?id=45412
Summary Fix a problem in createCanonicalUUIDString that causes the last digit missing...
Jian Li
Reported 2010-09-08 14:05:25 PDT
Fix a problem in createCanonicalUUIDString that causes the last digit missing on Linux
Attachments
Proposed Patch (2.51 KB, patch)
2010-09-08 14:11 PDT, Jian Li
darin: review+
jianli: commit-queue-
Jian Li
Comment 1 2010-09-08 14:11:38 PDT
Created attachment 66940 [details] Proposed Patch
Darin Adler
Comment 2 2010-09-08 14:15:21 PDT
Comment on attachment 66940 [details] Proposed Patch > char uuidStr[37] = {0}; There's no reason to initialize this. The fgets function will fill in the array including adding the '\0' terminator if it succeeds. And if it fails we don’t look at the array in our code.
Darin Adler
Comment 3 2010-09-08 14:15:52 PDT
Comment on attachment 66940 [details] Proposed Patch > char uuidStr[37] = {0}; > - if (!fgets(uuidStr, sizeof(uuidStr) - 1, fptr)) > + if (!fgets(uuidStr, sizeof(uuidStr), fptr)) > return String(); > fclose(fptr); This code leaks a file descriptor if fgets fails. We still need to call fclose, even if fgets failed.
Jian Li
Comment 4 2010-09-08 14:41:24 PDT
WebKit Review Bot
Comment 5 2010-09-08 20:11:26 PDT
http://trac.webkit.org/changeset/67017 might have broken Leopard Intel Debug (Tests)
Note You need to log in before you can comment on or make changes to this bug.