Fix bug in string.JavascriptSafe #1025

Merged
merged 1 commit into from Jul 22, 2015

Projects

None yet

4 participants

@meepdarknessmeep
Contributor

for example ("\x0034"):JavascriptSafe() would result in \034 in javascript land, which is wrong

@meepdarknessmeep meepdarknessmeep Fix bug in string.JavascriptSafe
for example ("\x0034"):JavascriptSafe() would result in \034 in javascript land, which is wrong
9d18f6e
@neico
Contributor
neico commented Jul 21, 2015

I don't see what this has to do with the zero string delimiter...

\0 != 0

@willox
Collaborator
willox commented Jul 21, 2015

string.JavascriptSafe ( "\0" .. "1" ) == \01 which JavaScript will interpret as a single byte. This is a good PR.
There's no security issues here really, just that little bug.

@neico
Contributor
neico commented Jul 22, 2015

If you use it like that then this makes more sense, his example though doesn't as much, \x would be \x and therefore change anything, and if I'm not totally wrong then \x0034 == \x34 == 52, but since I rarely use hex values in strings at all I wouldn't know for sure :/

@willox
Collaborator
willox commented Jul 22, 2015

"\x0034" = "\x00" .. "34"

@neico
Contributor
neico commented Jul 22, 2015

oh right, 2 numbers build one hex value. I really don't do this stuff enough...

nevermind then, go ahead~

@robotboy655 robotboy655 merged commit 3bfae37 into garrynewman:master Jul 22, 2015
@meepdarknessmeep meepdarknessmeep deleted the meepdarknessmeep:patch-3 branch Jul 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment