]> granicus.if.org Git - strace/commitdiff
print_fields.h: check whether passed field is an array in PRINT_FIELD_CSTRING
authorEugene Syromyatnikov <evgsyr@gmail.com>
Sat, 10 Mar 2018 04:09:42 +0000 (05:09 +0100)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 4 Apr 2018 16:33:19 +0000 (16:33 +0000)
* print_fields.h (PRINT_FIELD_CSTRING): Add MUST_BE_ARRAY to the size
value in order to check whether (where_).field_ is an array in compile
time.

print_fields.h

index a0f571cf6e1fd59bff4c42c32f91b9444c36f2ca..fff746388e966b2d43c133f66e6b15c42b717dca 100644 (file)
 #define PRINT_FIELD_CSTRING(prefix_, where_, field_)                   \
        do {                                                            \
                STRACE_PRINTF("%s%s=", (prefix_), #field_);             \
-               print_quoted_cstring((const char *)(where_).field_,     \
-                                    sizeof((where_).field_));          \
+               print_quoted_cstring((const char *) (where_).field_,    \
+                                    sizeof((where_).field_) +          \
+                                       MUST_BE_ARRAY((where_).field_)); \
        } while (0)
 
 #define PRINT_FIELD_HEX_ARRAY(prefix_, where_, field_)                 \