[PHP-CVS-DAILY] cvs: php4 / ChangeLog

2002-12-24 Thread changelog
changelog   Tue Dec 24 20:34:25 2002 EDT

  Modified files:  
/php4   ChangeLog 
  Log:
  ChangeLog update
  
  
Index: php4/ChangeLog
diff -u php4/ChangeLog:1.1218 php4/ChangeLog:1.1219
--- php4/ChangeLog:1.1218   Mon Dec 23 20:31:43 2002
+++ php4/ChangeLog  Tue Dec 24 20:34:22 2002
@@ -1,3 +1,46 @@
+2002-12-24  Stefan Esser  [EMAIL PROTECTED]
+
+* sapi/cgi/cgi_main.c:
+  fix compile warning
+
+* ext/mime_magic/mime_magic.c
+  sapi/cgi/cgi_main.c:
+  MFH
+
+* ext/mime_magic/mime_magic.c:
+  do correct casting
+
+2002-12-24  Ilia Alshanetsky  [EMAIL PROTECTED]
+
+* ext/ncurses/ncurses_functions.c:
+  Removed pointless assignment.
+
+* ext/ncurses/ncurses_functions.c:
+  The -1 is no longer needed, since it is done automatically by strlcpy().
+
+* ext/ncurses/ncurses_functions.c:
+  Changed strncpy() to strlcpy().
+
+* ext/ncurses/ncurses_fe.c
+  ext/ncurses/ncurses_functions.c:
+  A variety of CS style fixes, which include:
+   * Changed all argument parsing to use the new zend_parse_parameters()
+   * If a function is unavailable due to lack of support for a certain
+  feature,
+ do not make the function avaliable, rather then making it print an
+  error
+ saying that the functionality offered by the function is not avaliable.
+   * Lots of WS fixes all over the file.
+   * Change strcpy() to strncpy() to prevent possible buffer overflows.
+  Fixed a bug in ncurses_pair_content(), 1st parameter was wrong.
+  Fixed several function prototypes that failed to indicate that functions
+  accepted arguments by reference.
+
+2002-12-24  Melvyn Sopacua  [EMAIL PROTECTED]
+
+* ext/standard/dir.c:
+  MFH: crash fix in glob() with no results
+
 2002-12-23  Melvyn Sopacua  [EMAIL PROTECTED]
 
 * ext/standard/dir.c:





[PHP-CVS] cvs: php4(PHP_4_3) /ext/standard dir.c

2002-12-24 Thread Melvyn Sopacua
msopacuaTue Dec 24 10:04:10 2002 EDT

  Modified files:  (Branch: PHP_4_3)
/php4/ext/standard  dir.c 
  Log:
  MFH: crash fix in glob() with no results
  
  
Index: php4/ext/standard/dir.c
diff -u php4/ext/standard/dir.c:1.109.2.1 php4/ext/standard/dir.c:1.109.2.2
--- php4/ext/standard/dir.c:1.109.2.1   Thu Nov 14 17:51:21 2002
+++ php4/ext/standard/dir.c Tue Dec 24 10:04:10 2002
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: dir.c,v 1.109.2.1 2002/11/14 22:51:21 ssb Exp $ */
+/* $Id: dir.c,v 1.109.2.2 2002/12/24 15:04:10 msopacua Exp $ */
 
 /* {{{ includes/startup/misc */
 
@@ -400,6 +400,9 @@
 
/* we assume that any glob pattern will match files from one directory only
   so checking the dirname of the first match should be sufficient */
+   if (!globbuf.gl_pathv) {
+   RETURN_FALSE;
+   }
strncpy(cwd, globbuf.gl_pathv[0], MAXPATHLEN);
if (PG(safe_mode)  (!php_checkuid(cwd, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
RETURN_FALSE;



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




[PHP-CVS] cvs: php4 /ext/ncurses ncurses_fe.c ncurses_functions.c

2002-12-24 Thread Ilia Alshanetsky
iliaa   Tue Dec 24 12:20:33 2002 EDT

  Modified files:  
/php4/ext/ncurses   ncurses_fe.c ncurses_functions.c 
  Log:
  A variety of CS style fixes, which include:
   * Changed all argument parsing to use the new zend_parse_parameters()
   * If a function is unavailable due to lack of support for a certain feature, 
 do not make the function avaliable, rather then making it print an error 
 saying that the functionality offered by the function is not avaliable.
   * Lots of WS fixes all over the file.
   * Change strcpy() to strncpy() to prevent possible buffer overflows.
  Fixed a bug in ncurses_pair_content(), 1st parameter was wrong.
  Fixed several function prototypes that failed to indicate that functions 
  accepted arguments by reference.
  
  
Index: php4/ext/ncurses/ncurses_fe.c
diff -u php4/ext/ncurses/ncurses_fe.c:1.20 php4/ext/ncurses/ncurses_fe.c:1.21
--- php4/ext/ncurses/ncurses_fe.c:1.20  Mon Nov 25 07:30:24 2002
+++ php4/ext/ncurses/ncurses_fe.c   Tue Dec 24 12:20:33 2002
@@ -36,154 +36,164 @@
  * Every user visible function must have an entry in ncurses_functions[].
  */
 function_entry ncurses_functions[] = {
-  PHP_FE(ncurses_addch, NULL)
-  PHP_FE(ncurses_color_set, NULL)
-  PHP_FE(ncurses_delwin, NULL)
-  PHP_FE(ncurses_end, NULL)
-  PHP_FE(ncurses_getch, NULL)
-  PHP_FE(ncurses_has_colors, NULL)
-  PHP_FE(ncurses_init, NULL)
-  PHP_FE(ncurses_init_pair, NULL)
-  PHP_FE(ncurses_color_content, second_thru_fourth_args_force_ref)
-  PHP_FE(ncurses_pair_content, secondandthird_args_force_ref)
-  PHP_FE(ncurses_move, NULL)
-  PHP_FE(ncurses_newwin, NULL)
-  PHP_FE(ncurses_refresh, NULL)
-  PHP_FE(ncurses_start_color, NULL)
-  PHP_FE(ncurses_standout, NULL)
-  PHP_FE(ncurses_standend, NULL)
-  PHP_FE(ncurses_baudrate, NULL)
-  PHP_FE(ncurses_beep, NULL)
-  PHP_FE(ncurses_can_change_color, NULL)
-  PHP_FE(ncurses_cbreak, NULL)
-  PHP_FE(ncurses_clear, NULL)
-  PHP_FE(ncurses_clrtobot, NULL)
-  PHP_FE(ncurses_clrtoeol, NULL)
-  PHP_FE(ncurses_def_prog_mode, NULL)
-  PHP_FE(ncurses_reset_prog_mode, NULL)
-  PHP_FE(ncurses_def_shell_mode, NULL)
-  PHP_FE(ncurses_reset_shell_mode, NULL)
-  PHP_FE(ncurses_delch, NULL)
-  PHP_FE(ncurses_deleteln, NULL)
-  PHP_FE(ncurses_doupdate, NULL)
-  PHP_FE(ncurses_echo, NULL)
-  PHP_FE(ncurses_erase, NULL)
-  PHP_FE(ncurses_werase, NULL)
-  PHP_FE(ncurses_erasechar, NULL)
-  PHP_FE(ncurses_flash, NULL)
-  PHP_FE(ncurses_flushinp, NULL)
-  PHP_FE(ncurses_has_ic, NULL)
-  PHP_FE(ncurses_has_il, NULL)
-  PHP_FE(ncurses_inch, NULL)
-  PHP_FE(ncurses_insertln, NULL)
-  PHP_FE(ncurses_isendwin, NULL)
-  PHP_FE(ncurses_killchar, NULL)
-  PHP_FE(ncurses_nl, NULL)
-  PHP_FE(ncurses_nocbreak, NULL)
-  PHP_FE(ncurses_noecho, NULL)
-  PHP_FE(ncurses_nonl, NULL)
-  PHP_FE(ncurses_noraw, NULL)
-  PHP_FE(ncurses_raw, NULL)
-  PHP_FE(ncurses_meta, NULL)
-  PHP_FE(ncurses_resetty, NULL)
-  PHP_FE(ncurses_savetty, NULL)
-  PHP_FE(ncurses_termattrs, NULL)
-  PHP_FE(ncurses_use_default_colors, NULL)
-  PHP_FE(ncurses_slk_attr, NULL)
-  PHP_FE(ncurses_slk_clear, NULL)
-  PHP_FE(ncurses_slk_noutrefresh, NULL)
-  PHP_FE(ncurses_slk_refresh, NULL)
-  PHP_FE(ncurses_slk_restore, NULL)
-  PHP_FE(ncurses_slk_touch, NULL)
-  PHP_FE(ncurses_attroff, NULL)
-  PHP_FE(ncurses_attron, NULL)
-  PHP_FE(ncurses_attrset, NULL)
-  PHP_FE(ncurses_bkgd, NULL)
-  PHP_FE(ncurses_curs_set, NULL)
-  PHP_FE(ncurses_delay_output, NULL)
-  PHP_FE(ncurses_echochar, NULL)
-  PHP_FE(ncurses_halfdelay, NULL)
-  PHP_FE(ncurses_has_key, NULL)
-  PHP_FE(ncurses_insch, NULL)
-  PHP_FE(ncurses_insdelln, NULL)
-  PHP_FE(ncurses_mouseinterval, NULL)
-  PHP_FE(ncurses_napms, NULL)
-  PHP_FE(ncurses_scrl, NULL)
-  PHP_FE(ncurses_slk_attroff, NULL)
-  PHP_FE(ncurses_slk_attron, NULL)
-  PHP_FE(ncurses_slk_attrset, NULL)
-  PHP_FE(ncurses_slk_color, NULL)
-  PHP_FE(ncurses_slk_init, NULL)
-   PHP_FE(ncurses_slk_set, NULL)
-  PHP_FE(ncurses_typeahead, NULL)
-  PHP_FE(ncurses_ungetch, NULL)
-  PHP_FE(ncurses_vidattr, NULL)
-  PHP_FE(ncurses_wrefresh, NULL)
-  PHP_FE(ncurses_use_extended_names, NULL)
-  PHP_FE(ncurses_bkgdset, NULL)
-  PHP_FE(ncurses_filter, NULL)
-  PHP_FE(ncurses_noqiflush, NULL)
-  PHP_FE(ncurses_qiflush, NULL)
-  PHP_FE(ncurses_timeout, NULL)
-  PHP_FE(ncurses_use_env, NULL)
-  PHP_FE(ncurses_addstr, NULL)
-  PHP_FE(ncurses_putp, NULL)
-  PHP_FE(ncurses_scr_dump, NULL)
-  PHP_FE(ncurses_scr_init, NULL)
-  PHP_FE(ncurses_scr_restore, NULL)
-  PHP_FE(ncurses_scr_set, NULL)
-  PHP_FE(ncurses_mvaddch, NULL)
-  PHP_FE(ncurses_mvaddchnstr, NULL)
-  PHP_FE(ncurses_addchnstr, NULL)
-  PHP_FE(ncurses_mvaddchstr, NULL)
-  PHP_FE(ncurses_addchstr, NULL)
-  PHP_FE(ncurses_mvaddnstr, NULL)
-  PHP_FE(ncurses_addnstr, NULL)
-  PHP_FE(ncurses_mvaddstr, NULL)
-  PHP_FE(ncurses_mvdelch, NULL)
-  PHP_FE(ncurses_mvgetch, NULL)
-  PHP_FE(ncurses_mvinch, NULL)
-  PHP_FE(ncurses_mvwaddstr, NULL)
-  PHP_FE(ncurses_insstr, NULL)
-  PHP_FE(ncurses_instr, first_args_force_ref)
-  

Re: [PHP-CVS] cvs: php4 /ext/ncurses ncurses_fe.c ncurses_functions.c

2002-12-24 Thread Andi Gutmans
At 05:20 PM 12/24/2002 +, Ilia Alshanetsky wrote:

  * Change strcpy() to strncpy() to prevent possible buffer overflows.


Please change to strlcpy().

Andi


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




[PHP-CVS] cvs: php4 /ext/ncurses ncurses_functions.c

2002-12-24 Thread Ilia Alshanetsky
iliaa   Tue Dec 24 12:30:48 2002 EDT

  Modified files:  
/php4/ext/ncurses   ncurses_functions.c 
  Log:
  Changed strncpy() to strlcpy().
  
  
Index: php4/ext/ncurses/ncurses_functions.c
diff -u php4/ext/ncurses/ncurses_functions.c:1.33 
php4/ext/ncurses/ncurses_functions.c:1.34
--- php4/ext/ncurses/ncurses_functions.c:1.33   Tue Dec 24 12:20:33 2002
+++ php4/ext/ncurses/ncurses_functions.cTue Dec 24 12:30:48 2002
@@ -1768,7 +1768,7 @@

IS_NCURSES_INITIALIZED();
 
-   strncpy(temp, termname(), sizeof(temp) - 1);
+   strlcpy(temp, termname(), sizeof(temp) - 1);
temp[sizeof(temp) - 1] = '\0';
 
RETURN_STRINGL (temp, strlen(temp), 1);
@@ -1783,7 +1783,7 @@
 
IS_NCURSES_INITIALIZED();
 
-   strncpy(temp, longname(), sizeof(temp) - 1);
+   strlcpy(temp, longname(), sizeof(temp) - 1);
temp[sizeof(temp) - 1] = '\0';
 
RETURN_STRINGL (temp, strlen(temp), 1);



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




[PHP-CVS] cvs: php4 /ext/ncurses ncurses_functions.c

2002-12-24 Thread Ilia Alshanetsky
iliaa   Tue Dec 24 12:33:34 2002 EDT

  Modified files:  
/php4/ext/ncurses   ncurses_functions.c 
  Log:
  The -1 is no longer needed, since it is done automatically by strlcpy().
  
  
Index: php4/ext/ncurses/ncurses_functions.c
diff -u php4/ext/ncurses/ncurses_functions.c:1.34 
php4/ext/ncurses/ncurses_functions.c:1.35
--- php4/ext/ncurses/ncurses_functions.c:1.34   Tue Dec 24 12:30:48 2002
+++ php4/ext/ncurses/ncurses_functions.cTue Dec 24 12:33:33 2002
@@ -1768,7 +1768,7 @@

IS_NCURSES_INITIALIZED();
 
-   strlcpy(temp, termname(), sizeof(temp) - 1);
+   strlcpy(temp, termname(), sizeof(temp));
temp[sizeof(temp) - 1] = '\0';
 
RETURN_STRINGL (temp, strlen(temp), 1);
@@ -1783,7 +1783,7 @@
 
IS_NCURSES_INITIALIZED();
 
-   strlcpy(temp, longname(), sizeof(temp) - 1);
+   strlcpy(temp, longname(), sizeof(temp));
temp[sizeof(temp) - 1] = '\0';
 
RETURN_STRINGL (temp, strlen(temp), 1);



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




Re: [PHP-CVS] cvs: php4 /ext/ncurses ncurses_functions.c

2002-12-24 Thread Andi Gutmans
http://www.courtesan.com/todd/papers/strlcpy.html

It should be strlcpy(temp, blah, sizeof(temp));

That's one of the advantages of strlcpy(). It's much easier to use.

Andi

At 05:30 PM 12/24/2002 +, Ilia Alshanetsky wrote:

iliaa   Tue Dec 24 12:30:48 2002 EDT

  Modified files:
/php4/ext/ncurses   ncurses_functions.c
  Log:
  Changed strncpy() to strlcpy().


Index: php4/ext/ncurses/ncurses_functions.c
diff -u php4/ext/ncurses/ncurses_functions.c:1.33 
php4/ext/ncurses/ncurses_functions.c:1.34
--- php4/ext/ncurses/ncurses_functions.c:1.33   Tue Dec 24 12:20:33 2002
+++ php4/ext/ncurses/ncurses_functions.cTue Dec 24 12:30:48 2002
@@ -1768,7 +1768,7 @@

IS_NCURSES_INITIALIZED();

-   strncpy(temp, termname(), sizeof(temp) - 1);
+   strlcpy(temp, termname(), sizeof(temp) - 1);
temp[sizeof(temp) - 1] = '\0';

RETURN_STRINGL (temp, strlen(temp), 1);
@@ -1783,7 +1783,7 @@

IS_NCURSES_INITIALIZED();

-   strncpy(temp, longname(), sizeof(temp) - 1);
+   strlcpy(temp, longname(), sizeof(temp) - 1);
temp[sizeof(temp) - 1] = '\0';

RETURN_STRINGL (temp, strlen(temp), 1);



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


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




[PHP-CVS] cvs: php4 /ext/mime_magic mime_magic.c

2002-12-24 Thread Stefan Esser
sesser  Tue Dec 24 18:28:05 2002 EDT

  Modified files:  
/php4/ext/mime_magicmime_magic.c 
  Log:
  do correct casting
  
  
  
Index: php4/ext/mime_magic/mime_magic.c
diff -u php4/ext/mime_magic/mime_magic.c:1.20 php4/ext/mime_magic/mime_magic.c:1.21
--- php4/ext/mime_magic/mime_magic.c:1.20   Mon Dec 23 03:50:05 2002
+++ php4/ext/mime_magic/mime_magic.cTue Dec 24 18:28:05 2002
@@ -15,7 +15,7 @@
   | Author: Hartmut Holzgraefe  [EMAIL PROTECTED]   |
   +--+
 
-  $Id: mime_magic.c,v 1.20 2002/12/23 08:50:05 sesser Exp $ 
+  $Id: mime_magic.c,v 1.21 2002/12/24 23:28:05 sesser Exp $ 
 
   This module contains a lot of stuff taken from Apache mod_mime_magic,
   so the license section is a little bit longer than usual:
@@ -274,7 +274,7 @@
 PHP_MSHUTDOWN_FUNCTION(mime_magic)
 {
UNREGISTER_INI_ENTRIES();
-   if (mime_global.magic != NULL  (int)mime_global.magic != -1) {
+   if (mime_global.magic != NULL  mime_global.magic != (struct magic *) -1) {
struct magic *iter = mime_global.magic;
while (iter != NULL) {
struct magic *iter_next = iter-next;   
@@ -312,7 +312,7 @@
return;
}
 
-   if ((int) conf-magic == -1) {
+   if (conf-magic == (struct magic *)-1) {
php_error(E_ERROR, MODNAME  could not be initialized, magic file %s 
is not avaliable,  conf-magicfile);
RETURN_FALSE;
} 
@@ -358,7 +358,7 @@
 fname = conf-magicfile; /* todo cwd? */
 f = fopen(fname, rb);
 if (f == NULL) {
-   *(int *)conf-magic = -1;
+   conf-magic = (struct magic *)-1;
return -1;
 }
 



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




[PHP-CVS] cvs: php4(PHP_4_3) /ext/mime_magic mime_magic.c

2002-12-24 Thread Stefan Esser
sesser  Tue Dec 24 18:30:52 2002 EDT

  Modified files:  (Branch: PHP_4_3)
/php4/ext/mime_magicmime_magic.c 
  Log:
  MFH
  
  
  
Index: php4/ext/mime_magic/mime_magic.c
diff -u php4/ext/mime_magic/mime_magic.c:1.13.2.5 
php4/ext/mime_magic/mime_magic.c:1.13.2.6
--- php4/ext/mime_magic/mime_magic.c:1.13.2.5   Mon Dec 23 03:51:16 2002
+++ php4/ext/mime_magic/mime_magic.cTue Dec 24 18:30:51 2002
@@ -12,10 +12,10 @@
   | obtain it through the world-wide-web, please send a note to  |
   | [EMAIL PROTECTED] so we can mail you a copy immediately.   |
   +--+
-  | Author: Hartmut Holzgraefe  [EMAIL PROTECTED] |
+  | Author: Hartmut Holzgraefe  [EMAIL PROTECTED]   |
   +--+
 
-  $Id: mime_magic.c,v 1.13.2.5 2002/12/23 08:51:16 sesser Exp $ 
+  $Id: mime_magic.c,v 1.13.2.6 2002/12/24 23:30:51 sesser Exp $ 
 
   This module contains a lot of stuff taken from Apache mod_mime_magic,
   so the license section is a little bit longer than usual:
@@ -274,7 +274,7 @@
 PHP_MSHUTDOWN_FUNCTION(mime_magic)
 {
UNREGISTER_INI_ENTRIES();
-   if (mime_global.magic != NULL  (int)mime_global.magic != -1) {
+   if (mime_global.magic != NULL  mime_global.magic != (struct magic *) -1) {
struct magic *iter = mime_global.magic;
while (iter != NULL) {
struct magic *iter_next = iter-next;   
@@ -312,7 +312,7 @@
return;
}
 
-   if ((int) conf-magic == -1) {
+   if (conf-magic == (struct magic *)-1) {
php_error(E_ERROR, MODNAME  could not be initialized, magic file %s 
is not avaliable,  conf-magicfile);
RETURN_FALSE;
} 
@@ -358,7 +358,7 @@
 fname = conf-magicfile; /* todo cwd? */
 f = fopen(fname, rb);
 if (f == NULL) {
-   *(int *)conf-magic = -1;
+   conf-magic = (struct magic *)-1;
return -1;
 }
 



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




[PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c

2002-12-24 Thread Stefan Esser
sesser  Tue Dec 24 18:46:18 2002 EDT

  Modified files:  
/php4/sapi/cgi  cgi_main.c 
  Log:
  fix compile warning
  
  
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.200 php4/sapi/cgi/cgi_main.c:1.201
--- php4/sapi/cgi/cgi_main.c:1.200  Sun Dec  1 21:16:38 2002
+++ php4/sapi/cgi/cgi_main.cTue Dec 24 18:46:17 2002
@@ -121,7 +121,7 @@
 
 #if ENABLE_PATHINFO_CHECK
 /* true global.  this is retreived once only, even for fastcgi */
-int fix_pathinfo=1;
+long fix_pathinfo=1;
 #endif
 
 #ifdef PHP_WIN32



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




[PHP-CVS] cvs: php4(PHP_4_3) /sapi/cgi cgi_main.c

2002-12-24 Thread Stefan Esser
sesser  Tue Dec 24 18:50:21 2002 EDT

  Modified files:  (Branch: PHP_4_3)
/php4/sapi/cgi  cgi_main.c 
  Log:
  MFH
  
  
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.190.2.7 php4/sapi/cgi/cgi_main.c:1.190.2.8
--- php4/sapi/cgi/cgi_main.c:1.190.2.7  Sun Dec  1 21:21:01 2002
+++ php4/sapi/cgi/cgi_main.cTue Dec 24 18:50:21 2002
@@ -121,7 +121,7 @@
 
 #if ENABLE_PATHINFO_CHECK
 /* true global.  this is retreived once only, even for fastcgi */
-int fix_pathinfo=1;
+long fix_pathinfo=1;
 #endif
 
 #ifdef PHP_WIN32



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