1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| static int test_puny1(void) { static const unsigned int out[8] = { 0x0033, 0x5E74, 0x0042, 0x7D44, 0x91D1, 0x516B, 0x5148, 0x751F }; static const char* in = "3B-ww4c5e180e575a65lsy2b"; unsigned int buf[8]; unsigned int bsize = 7;
int result = ossl_punycode_decode(in, strlen(in), buf, &bsize); printf("bsize: %d\n",bsize); for(int i=0;i<bsize;i++){ printf("%x ",buf[i]); } printf("\n"); if (result!=0) { if (test_mem_eq(buf, bsize * sizeof(*buf), out, sizeof(out))) printf("CRITICAL: buffer overrun detected!\n"); return 0;
} return 1; }
|