I don't think it's a good idea to access s[-1] even if the logic works.
This should be fixed IMO.
At 10:30 PM 6/14/2004 +0200, Christian Schneider wrote:
Ilia Alshanetsky wrote:
Do you have an example script that can be used to reproduce the supposed
memory access violation?
The function php_bas
Hi,
The function php_basename actually DOES access the char at s-1, i.e. one
byte before the string it is passed. If you hand it a buffer gotten from
malloc you get a valgrind hit. If I use emalloc this doesn't happen, I
guess emalloc has some header stuff before the allocation. If for
whatever
Ilia Alshanetsky wrote:
Do you have an example script that can be used to reproduce the supposed
memory access violation?
The function php_basename actually DOES access the char at s-1, i.e. one
byte before the string it is passed. If you hand it a buffer gotten from
malloc you get a valgrind hi
Do you have an example script that can be used to reproduce the supposed
memory access violation?
Ilia
On June 14, 2004 01:51 pm, Alexander Valyalkin wrote:
> Here is patch for basename() function, which prevents possible
> memory access violation:
>
> =cut=
> --- string.cThu
Here is patch for basename() function, which prevents possible
memory access violation:
=cut=
--- string.cThu May 13 20:44:32 2004
+++ string_basename.c Mon Jun 14 20:43:33 2004
@@ -1079,9 +1079,9 @@
/* strip trailing slashes */
- while (*c == '/'
+while (c >= s && *