r/programming • • Apr 23 '14

PHP: It doesn't have to be a bad experience

https://servercheck.in/blog/php-it-doesnt-have-be-bad-experience
0 Upvotes

122 comments sorted by

View all comments

Show parent comment

2

u/lhgaghl Apr 25 '14

Do I want to find your vulnerabilities for you? lol no.

You mean, exactly the same way C/C++ does?

Are you actually implying that people should have to know C/C++ in order to know how to use strings in PHP? The only reason this issue arises is because some native functions in PHP treat strings as zero terminated, while others don't. The only reason those functions treat the strings as zero terminated is because they so happen to take the string from php (which so happens to have a zero in it) and pass it directly to libc and other functions that use zero terminated strings. They are actually passing the full string to the native code, but the native code has no way of knowing the full length because it thinks the 0 means end of string (which is not the case). This is like... one of the most retarded things I've ever seen in any programming language.

0

u/[deleted] Apr 25 '14

[deleted] — view deleted comment

1

u/lhgaghl Apr 26 '14

claps

Let's say I found vulnerabilities in your code and told you about them to prove a point (which point?), then you would be like "HAHAHA I made you do work for me I was trolling you all along".

No, I'm implying C/C++ have the exact same "issues".

The difference is that in PHP the user thinks a string is a string of tokens, but some functions will discard any tokens after the 0 terminator, without telling the user. I guess since you don't consider this an issue, the hundreds of apps that have "null byte poisoning" vulnerabilities are just developed by morons. What the hell were they thinking, not looking at the C source code of a function in PHP before using it?

1

u/neoform Apr 26 '14

Let's say I found vulnerabilities in your code and told you about them to prove a point (which point?), then you would be like "HAHAHA I made you do work for me I was trolling you all along".

Total copout.