hope your having a nice day; so i have the following code that i want to know if it would somehow overflow at some point ::
static void * myalloc(size_t len) {
void * p = malloc(len);
if (p == NULL) {
fprintf(stderr, "end of memory\n");
exit(1);
}
return p;
}
static void * copy_buf(void * buf, uint32_t count, uint32_t be) {
uint32_t * p = NULL;
if (buf != NULL) {
p = myalloc(count * 4);
memcpy(p, buf, count * 4);
}
// more code
return p;
}
if it did not overflow, would something else cause it to do so, i mean if the variables changed. or the parameters changed (not the data type of course, but the value of them).
thank you for your help, the full source code is much bigger (more than a one file and more that 2000 lines of code for each one), but this is one of the parts that i am concerned about…
have a nice day.