ref: 5aeddd6788347f121f1c6739a9954fe176fe539e
parent: 263b0e34b2cedd426d165fbf42437d2d45f80361
author: cinap_lenrek <[email protected]>
date: Mon Jan 4 14:09:25 EST 2016
libmp: check nil return value of strtomp() in test program
--- a/sys/src/libmp/test.c
+++ b/sys/src/libmp/test.c
@@ -40,7 +40,8 @@
for(i=0; i<nelem(base); i++){
p = mptoa(b, base[i], nil, 0);
print("base%d: %s = ", base[i], p);
- strtomp(p, nil, base[i], b);
+ if(strtomp(p, nil, base[i], b) == nil)
+ abort();
free(p);
print("%B\n", b, base[i], b);
@@ -51,7 +52,8 @@
case 16:
p = smprint("%#.*B", base[i], b);
print("# %s = ", p);
- strtomp(p, nil, 0, b);
+ if(strtomp(p, nil, 0, b) == nil)
+ abort();
free(p);
print("%#.*B\n", base[i], b);
break;