this leaves tmp empty:
Code: Select all
#include <stdlib.h>
char *tmp = &freespace;
long long int offset = 33526363;
_itoa(offset, &tmp, 16);
Code: Select all
// declared outright
char *test_itoa(int n, char *buf, int radix)
{
char *ret = buf;
char tmp[33];
int i = 0, j, r;
/* validate the conversion number base. */
if ((radix >= 2) && (radix <= 36)) {
if ((radix == 10) && (n < 0)) {
/* negative integer value. */
*buf++ = '-';
n = -n;
}
do {
/* calculate the current digit. */
r = (int)((unsigned int)n % radix);
tmp[i++] = ((r < 10) ? (r + '0') : (r - 10 + 'a'));
} while ((n /= radix) != 0);
/* reverse the buffer string. */
for (--i, j = 0; (i >= 0); --i, ++j) buf[j] = tmp[i];
buf[j] = 0;
}
return (ret);
}
char *tmp = &freespace;
long long int offset = 33526363;
test_itoa(offset, &tmp, 16);