Closed rflynn closed 11 years ago
This code is checking for the resize URL that starts like http:/foobar.com/image.png. The r->uri value would be something like "/thumbnail/100x100/http:/foobar.com/image.png".
I'm not sure I understand how the use of strstr() is wrong. strstr() returns a pointer to the first occurrence of http:/ or null if it cannot find it. The pointer arithmetic should be safe on the return value.
Any chance you can implement it the way you think is correct and submit a pull request?
Ah, my mistake. I thought it was checking only the prefix. Thanks for the explanation.
https://github.com/beetlebugorg/mod_dims/blob/master/src/mod_dims.c#L1287
mixes position-independent use of string searching "strstr()" and position-dependent pointer arithmetic to check for urls that start with "http:/" but not "http://"... use strncmp() or memcp() instead.