Re: [PHP-CVS] cvs: non-pecl /simple_cvs simple_cvs.c simple_cvs_defs.h simple_cvs_utils.c

2004-04-20 Thread Marcus Boerger
Hello Shie,

Tuesday, April 20, 2004, 9:30:41 AM, you wrote:

> shie  Tue Apr 20 03:30:41 2004 EDT

>   Modified files:  
> /non-pecl/simple_cvs  simple_cvs.c simple_cvs_defs.h 
>   simple_cvs_utils.c 
>   Log:
>   fixed: sprintf==>snprintf (thanks to derick)
  
@@ -417,7 +416,7 @@
Please use the SCVS_STAT_* constants to check for statuses  */
 PHP_FUNCTION(scvs_status)
 {
-   char *un, buf[1024];
+   char *un, buf[BUFSIZE];
int un_len;

if (ZEND_NUM_ARGS() != 1 ||
@@ -435,7 +434,7 @@
if(array_init(return_value) != SUCCESS) zend_error(E_ERROR, "unable to create 
array");
 
/* chdir into the module dir - thereby performing the MINIMAL sanity check */
-   sprintf(buf, "%s/%s", GGET(workingDir), GGET(moduleName));
+   snprintf(buf, BUFSIZE, "%s/%s", GGET(workingDir), GGET(moduleName));
if (chdir(buf) != 0) {
[...]

This pretty much looks like spprintf would be correct.
  
-- 
Best regards,
 Marcusmailto:[EMAIL PROTECTED]

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: non-pecl /simple_cvs simple_cvs.c

2004-04-19 Thread Derick Rethans
On Mon, 19 Apr 2004, Andi Gutmans wrote:

> At 12:42 PM 4/19/2004 +0200, Derick Rethans wrote:
> >On Mon, 19 Apr 2004, Shie Erlich wrote:
> >
> > > shie  Mon Apr 19 06:35:07 2004 EDT
> > >
> > >   Modified files:
> > > /non-pecl/simple_cvs  simple_cvs.c
> > >   Log:
> > >   fixed: free(NULL) doesn't behave as the manpage says it does
> >
> >free(NULL) (c library function) is a no-op, but efree(NULL) (zend
> >memory alloc thingy) will crash.
>
> Yeah. I think we shouldn't add that additional if() to efree() and prefer
> to leave it as-is.

Right, it helps debugging things.

Derick

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: non-pecl /simple_cvs simple_cvs.c

2004-04-19 Thread Andi Gutmans
At 12:42 PM 4/19/2004 +0200, Derick Rethans wrote:
On Mon, 19 Apr 2004, Shie Erlich wrote:

> shie  Mon Apr 19 06:35:07 2004 EDT
>
>   Modified files:
> /non-pecl/simple_cvs  simple_cvs.c
>   Log:
>   fixed: free(NULL) doesn't behave as the manpage says it does
free(NULL) (c library function) is a no-op, but efree(NULL) (zend
memory alloc thingy) will crash.
Yeah. I think we shouldn't add that additional if() to efree() and prefer 
to leave it as-is.

Andi

--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-CVS] cvs: non-pecl /simple_cvs simple_cvs.c

2004-04-19 Thread Derick Rethans
On Mon, 19 Apr 2004, Shie Erlich wrote:

> shie  Mon Apr 19 06:35:07 2004 EDT
>
>   Modified files:
> /non-pecl/simple_cvs  simple_cvs.c
>   Log:
>   fixed: free(NULL) doesn't behave as the manpage says it does

free(NULL) (c library function) is a no-op, but efree(NULL) (zend
memory alloc thingy) will crash.

regards,
Derick

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php