Make 112_backtrace/bcheck_123 more robust

the strcat checker first checks dest for overlap, then src.
If the padding byte between b[] and the pad[] arrays happens to be zero
the dest check would have succeeded and the src test failed.  If that
padding byte would be zero the dest check would trigger first.
As we can't influence the padding byte (only the b[] and pad[] arrays)
it was random if the dest or src checks triggered.

This makes it reliably trigger the dest check first.
This commit is contained in:
Michael Matz 2020-01-18 03:06:44 +01:00
parent 2b7cffac74
commit a5f6e6189e
2 changed files with 2 additions and 2 deletions

View File

@ -150,7 +150,7 @@ int main()
#elif defined test_bcheck_122
strcat(&a[7], &a[0]);
#elif defined test_bcheck_123
strcat(&a[0], &b[5]);
strcat(&a[0], &b[3]);
#elif defined test_bcheck_124
strcat(&a[0], &a[4]);
#elif defined test_bcheck_125

View File

@ -142,7 +142,7 @@
[test_bcheck_123]
112_backtrace.c:153: at main: BCHECK: ........ is outside of the region
112_backtrace.c:153: at main: BCHECK: invalid pointer ........, size 0x? in strcat src
112_backtrace.c:153: at main: BCHECK: invalid pointer ........, size 0x? in strcat dest
[returns 255]
[test_bcheck_124]