Ignore:
Timestamp:
Jul 2, 2010, 4:26:23 PM (15 years ago)
Author:
[email protected]
Message:

Patch for https://bugs.webkit.org/show_bug.cgi?id=41548
Use snprintf instead of sprintf everywhere in JavaScriptCore

Reviewed by Geoffrey Garen.

  • runtime/JSGlobalObjectFunctions.cpp:

(JSC::encode):
(JSC::globalFuncEscape):

  • runtime/UString.cpp:

(JSC::UString::from):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp

    r60762 r62414  
    6767        else {
    6868            char tmp[4];
    69             snprintf(tmp, 4, "%%%02X", static_cast<unsigned char>(c));
     69            snprintf(tmp, sizeof(tmp), "%%%02X", static_cast<unsigned char>(c));
    7070            builder.append(tmp);
    7171        }
     
    387387        if (u > 255) {
    388388            char tmp[7];
    389             sprintf(tmp, "%%u%04X", u);
     389            snprintf(tmp, sizeof(tmp), "%%u%04X", u);
    390390            builder.append(tmp);
    391391        } else if (u != 0 && strchr(do_not_escape, static_cast<char>(u)))
     
    393393        else {
    394394            char tmp[4];
    395             sprintf(tmp, "%%%02X", u);
     395            snprintf(tmp, sizeof(tmp), "%%%02X", u);
    396396            builder.append(tmp);
    397397        }
Note: See TracChangeset for help on using the changeset viewer.