Skip to content
  • Gabor Buella's avatar
    logging example -- fix a typo in a condition · 9e26a719
    Gabor Buella authored
    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     	}
    ```
    9e26a719