cvs: php4(PHP_4_3) /ext/exif exif.c
| From: | Marcus Boerger | Date: | Wed, 16 Apr 2003 18:20:27 +0000 |
| Subject: | cvs: php4(PHP_4_3) /ext/exif exif.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-20328@lists.php.net to get a copy of this message | ||
helly Wed Apr 16 14:20:27 2003 EDT
Modified files: (Branch: PHP_4_3)
/php4/ext/exif exif.c
Log:
Use safe_emalloc but as macro until the function is fixed
Index: php4/ext/exif/exif.c
diff -u php4/ext/exif/exif.c:1.118.2.17 php4/ext/exif/exif.c:1.118.2.18
--- php4/ext/exif/exif.c:1.118.2.17 Mon Apr 7 20:19:29 2003
+++ php4/ext/exif/exif.c Wed Apr 16 14:20:27 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: exif.c,v 1.118.2.17 2003/04/08 00:19:29 iliaa Exp $ */
+/* $Id: exif.c,v 1.118.2.18 2003/04/16 18:20:27 helly Exp $ */
/* ToDos
*
@@ -70,6 +70,11 @@
typedef unsigned char uchar;
+//#undef safe_emalloc
+#ifndef safe_emalloc
+# define safe_emalloc(a,b,c) emalloc((a)*(b)+(c))
+#endif
+
#ifndef TRUE
# define TRUE 1
# define FALSE 0
@@ -95,7 +100,7 @@
};
/* }}} */
-#define EXIF_VERSION "1.4 $Id: exif.c,v 1.118.2.17 2003/04/08 00:19:29 iliaa Exp $"
+#define EXIF_VERSION "1.4 $Id: exif.c,v 1.118.2.18 2003/04/16 18:20:27 helly Exp $"
/* {{{ PHP_MINFO_FUNCTION
*/
@@ -1331,7 +1336,7 @@
for(i=0; i<SECTION_COUNT; i++) {
len += strlen(exif_get_sectionname(i))+2;
}
- sections = emalloc(len+1);
+ sections = safe_emalloc(len, 1, 1);
if (!sections) {
EXIF_ERRLOG_EALLOC
return NULL;
@@ -1616,7 +1621,7 @@
break;
} else
if (length>1) {
- info_data->value.list = emalloc(length*sizeof(image_info_value));
+ info_data->value.list = safe_emalloc(length, sizeof(image_info_value), 1);
if (!info_data->value.list) {
EXIF_ERRLOG_EALLOC
return;
@@ -1791,7 +1796,7 @@
EXIF_ERRLOG_EALLOC
return;
}
- info_data->value.s = emalloc(length+1);
+ info_data->value.s = safe_emalloc(length, 1, 1);
if (!info_data->value.s) {
EXIF_ERRLOG_EALLOC
return;
@@ -2525,7 +2530,7 @@
* force end of string.
*/
if (byte_count) {
- (*result) = emalloc(byte_count+1);
+ (*result) = safe_emalloc(byte_count, 1, 1);
memcpy(*result, value, byte_count);
(*result)[byte_count] = '\0';
return byte_count+1;
@@ -2871,7 +2876,7 @@
/* When there are any characters after the first NUL */
ImageInfo->CopyrightPhotographer = estrdup(value_ptr);
ImageInfo->CopyrightEditor = estrdup(value_ptr+length+1);
- ImageInfo->Copyright =
emalloc(strlen(value_ptr)+strlen(value_ptr+length+1)+3);
+ ImageInfo->Copyright = safe_emalloc(strlen(value_ptr)+3, 1,
strlen(value_ptr+length+1));
if (!ImageInfo->Copyright) {
EXIF_ERRLOG_EALLOC
} else {
@@ -3825,7 +3830,7 @@
if(ac >= 2) {
convert_to_string_ex(p_sections_needed);
- sections_str = emalloc(strlen(Z_STRVAL_PP(p_sections_needed))+3);
+ sections_str = safe_emalloc(strlen(Z_STRVAL_PP(p_sections_needed)), 1, 3);
if (!sections_str) {
EXIF_ERRLOG_EALLOC
RETURN_FALSE;