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
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++) {
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;
}
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;
}
* 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;
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;