diff --git a/buffer/prs_readblob.c b/buffer/prs_readblob.c index bccac50..28017df 100644 --- a/buffer/prs_readblob.c +++ b/buffer/prs_readblob.c @@ -73,7 +73,7 @@ int main() { // now try to provoke integer overflow bs_init_membuf(&bs, (const unsigned char*)"\x34\x12", 2); assert(bs_get(&bs) == 0x34); - assert(prs_readblob(&bs, buf, (size_t)-1) == -1); + assert(prs_readblob(&bs, buf, (size_t)-1) == -1); // ignore compiler warning pls // a bad implementation would add 0xffffffff to the 1 we already read and wrap to 0 // our code makes sure not to wrap and also limits the length of the // blob to max_ssize_t (0x7fffffff). diff --git a/ent.c b/ent.c index 81e76f0..edb68d9 100644 --- a/ent.c +++ b/ent.c @@ -1,4 +1,5 @@ #define _BSD_SOURCE +#define _DEFAULT_SOURCE #include #include #include diff --git a/scan/scan_xlongn.c b/scan/scan_xlongn.c index 181196e..2c3958d 100644 --- a/scan/scan_xlongn.c +++ b/scan/scan_xlongn.c @@ -32,7 +32,7 @@ int main() { if (sizeof(i)==4) assert(scan_xlongn("fefec0debaad",14,&i)==8 && i==0xfefec0de); // test truncation else if (sizeof(i)==8) - assert(scan_xlongn("fefec0debaadc0debl06",40,&i)==16 && i==0xfefec0debaadc0de); // test truncation + assert(scan_xlongn("fefec0debaadc0debl06",21,&i)==16 && i==0xfefec0debaadc0de); // test truncation return 0; } #endif