Commit 9e26a719 authored by Gabor Buella's avatar Gabor Buella

logging example -- fix a typo in a condition

Found by Coverity:
```
*** CID 1456740:  Memory - illegal accesses  (OVERRUN)
/syscall_intercept-ubuntu-16.04/examples/syscall_logger.c: 700 in print_rdec()
694     static char *
695     print_rdec(char *dst, long n)
696     {
697     	dst = print_signed_dec(dst, n);
698
699     	if (n < 0 && n >= -((long)ARRAY_SIZE(error_codes))) {
>>>     CID 1456740:  Memory - illegal accesses  (OVERRUN)
>>>     Overrunning array "error_codes" of 134 8-byte elements at element index 134 (byte offset 1072) using index "-n" (which evaluates to 134).
700     		if (error_codes[-n] != NULL) {
701     			dst = print_cstr(dst, " (");
702     			dst = print_cstr(dst, error_codes[-n]);
703     			dst = print_cstr(dst, ")");
704     		}
705     	}
```
parent 7149bf2f
......@@ -696,7 +696,7 @@ print_rdec(char *dst, long n)
{
dst = print_signed_dec(dst, n);
if (n < 0 && n >= -((long)ARRAY_SIZE(error_codes))) {
if (n < 0 && n > -((long)ARRAY_SIZE(error_codes))) {
if (error_codes[-n] != NULL) {
dst = print_cstr(dst, " (");
dst = print_cstr(dst, error_codes[-n]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment