/* overflow */
return -1;
}
+
+ newlen = device->length + device->allocsz;
+ tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen);
+ if (tmp == NULL) {
+ return -1;
+ }
+ device->length = newlen;
+ device->buffer = tmp;
}
device->buffer[device->pos++] = (unsigned char)c;
/* overflow */
return -1;
}
+
+ newlen = device->length + device->allocsz;
+ tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen);
+ if (tmp == NULL) {
+ return -1;
+ }
+ device->length = newlen;
+ device->buffer = tmp;
}
device->buffer[device->pos++] = (unsigned char)((c >> 8) & 0xff);
/* overflow */
return -1;
}
+
+ newlen = device->length + device->allocsz;
+ tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen);
+ if (tmp == NULL) {
+ return -1;
+ }
+ device->length = newlen;
+ device->buffer = tmp;
}
device->buffer[device->pos++] = (unsigned char)((c >> 24) & 0xff);
/* overflow */
return -1;
}
+
+ newlen = device->length + len + MBFL_MEMORY_DEVICE_ALLOC_SIZE;
+ tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen);
+ if (tmp == NULL) {
+ return -1;
+ }
+
+ device->length = newlen;
+ device->buffer = tmp;
}
w = &device->buffer[device->pos];
/* overflow */
return -1;
}
+
+ newlen = device->length + device->allocsz;
+ if (newlen > SIZE_MAX / sizeof(int)) {
+ /* overflow */
+ return -1;
+ }
+
+ tmp = (unsigned int *)mbfl_realloc((void *)device->buffer, newlen*sizeof(int));
+ if (tmp == NULL) {
+ return -1;
+ }
+ device->length = newlen;
+ device->buffer = tmp;
}
device->buffer[device->pos++] = c;