cvs: php4 /ext/exif exif.c
| From: | Marcus Boerger | Date: | Wed, 16 Apr 2003 06:10:42 +0000 |
| Subject: | cvs: php4 /ext/exif exif.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-20304@lists.php.net to get a copy of this message | ||
helly Wed Apr 16 02:10:42 2003 EDT
Modified files:
/php4/ext/exif exif.c
Log:
Change to use safe_emalloc() and provide macro for now
Index: php4/ext/exif/exif.c
diff -u php4/ext/exif/exif.c:1.144 php4/ext/exif/exif.c:1.145
--- php4/ext/exif/exif.c:1.144 Mon Apr 7 20:18:57 2003
+++ php4/ext/exif/exif.c Wed Apr 16 02:10:41 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: exif.c,v 1.144 2003/04/08 00:18:57 iliaa Exp $ */
+/* $Id: exif.c,v 1.145 2003/04/16 06:10:41 helly Exp $ */
/* ToDos
*
@@ -70,6 +70,10 @@
typedef unsigned char uchar;
+#ifndef safe_emalloc
+# define safe_emalloc(a,b,c) emalloc((a)*(b)+(c))
+#endif
+
#ifndef TRUE
# define TRUE 1
# define FALSE 0
@@ -95,7 +99,7 @@
};
/* }}} */
-#define EXIF_VERSION "1.4 $Id: exif.c,v 1.144 2003/04/08 00:18:57 iliaa Exp $"
+#define EXIF_VERSION "1.4 $Id: exif.c,v 1.145 2003/04/16 06:10:41 helly Exp $"
/* {{{ PHP_MINFO_FUNCTION
*/
@@ -1329,7 +1333,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);
sections[0] = '\0';
len = 0;
for(i=0; i<SECTION_COUNT; i++) {
@@ -1598,7 +1602,7 @@
break;
} else
if (length>1) {
- info_value->list = emalloc(length*sizeof(image_info_value));
+ info_value->list = safe_emalloc(length, sizeof(image_info_value), 0);
} else {
info_value = &info_data->value;
}
@@ -1752,7 +1756,7 @@
info_data->value.s = php_addslashes(value, length, &length, 0 TSRMLS_CC);
info_data->length = length;
} else {
- info_data->value.s = emalloc(length+1);
+ info_data->value.s = safe_emalloc(length, 1, 1);
memcpy(info_data->value.s, value, length);
info_data->value.s[length] = 0;
}
@@ -2458,7 +2462,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;
@@ -3737,7 +3741,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);
sprintf(sections_str, ",%s,", Z_STRVAL_PP(p_sections_needed));
/* sections_str DOES start with , and SPACES are NOT allowed in names */
s = sections_str;