v3d: use snprintf(..., "%s", ...) instead of strncpy
authorEric Anholt <eric@anholt.net>
Tue, 31 Jul 2018 23:41:28 +0000 (16:41 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 31 Jul 2018 23:42:11 +0000 (16:42 -0700)
Fixes a compiler warning about terminator NUL, based on f836d799f906
("intel/decoder: use snprintf(..., "%s", ...) instead of strncpy")

src/broadcom/cle/v3d_decoder.c

index 00d67b2a2e6273fde2ec3b9a7045dc1269506ee3..4496388e319ec86d2f66b3639ae1b0c5dbd51a4a 100644 (file)
@@ -834,7 +834,7 @@ iter_advance_field(struct v3d_field_iterator *iter)
 
         iter->field = iter->group->fields[iter->field_iter++];
         if (iter->field->name)
-                strncpy(iter->name, iter->field->name, sizeof(iter->name));
+                snprintf(iter->name, sizeof(iter->name), iter->field->name);
         else
                 memset(iter->name, 0, sizeof(iter->name));
         iter->offset = iter_group_offset_bits(iter, iter->group_iter) / 8 +