Closed Bug 1272298 Opened 8 years ago Closed 8 years ago

NULL character (U+0000) in the form can not be submitted

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla49
Tracking Status
firefox49 --- fixed

People

(Reporter: 446240525, Assigned: baku)

Details

Attachments

(1 file)

open http://output.jsbin.com/hubihutige, click the submit button. 

the url in location bar should be http://output.jsbin.com/hubihutige?name=%00
Assignee: nobody → amarchesini
Attached patch escape.patchSplinter Review
Attachment #8752231 - Flags: review?(bugs)
Comment on attachment 8752231 [details] [diff] [review]
escape.patch

>-nsFSURLEncoded::URLEncode(const nsAString& aStr, nsCString& aEncoded)
>+nsFSURLEncoded::URLEncode(const nsAString& aStr, nsACString& aEncoded)
> {
>   // convert to CRLF breaks
>+  int32_t convertedBufLength = 0;
>   char16_t* convertedBuf =
>-    nsLinebreakConverter::ConvertUnicharLineBreaks(PromiseFlatString(aStr).get(),
>+    nsLinebreakConverter::ConvertUnicharLineBreaks(aStr.BeginReading(),
>                                                    nsLinebreakConverter::eLinebreakAny,
>-                                                   nsLinebreakConverter::eLinebreakNet);
>+                                                   nsLinebreakConverter::eLinebreakNet,
>+                                                   aStr.Length(),
>+                                                   &convertedBufLength);
>   NS_ENSURE_TRUE(convertedBuf, NS_ERROR_OUT_OF_MEMORY);
> 
>+  nsAutoString convertedString;
>+  convertedString.Adopt(convertedBuf, convertedBufLength);
Could the string be just nsString, given that you don't use the internal buffer for anything.

I wonder if we could get rid of nsEscape and just always use nsEscapeWithLength, and then pass ns(C)String around, and not raw char pointers.
But not about this bug.
Attachment #8752231 - Flags: review?(bugs) → review+
https://hg.mozilla.org/mozilla-central/rev/e486707bccdc
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
Component: HTML: Form Submission → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: