Skip to content

Commit

Permalink
Fix a stringop-truncation warning reported by gcc 10
Browse files Browse the repository at this point in the history
In function ‘strncpy’,
    inlined from ‘add_classid_to_signatureclass’ at /home/travis/build/nickbroon/vermont/src/modules/analysis/fpsigmatcher/Signature.c:204:2:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: error: ‘__builtin_strncpy’ specified bound 50 equals destination size [-Werror=stringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • Loading branch information
nickbroon committed May 27, 2020
1 parent e2cddc4 commit 4c1b3f3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/modules/analysis/fpsigmatcher/Signature.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ void add_classid_to_signatureclass(struct SignatureClass * class, char * new_mem
// I think that a class id is not added to a signature, but a signature id to a class.
class->member_IDs = realloc(class->member_IDs, sizeof(char *) * (class->numOfMembers + 1));
class->member_IDs[class->numOfMembers] = malloc(sizeof(char) * ID_STRING_SIZE);
strncpy(class->member_IDs[class->numOfMembers], new_memberID, ID_STRING_SIZE);
strncpy(class->member_IDs[class->numOfMembers], new_memberID, ID_STRING_SIZE-1);
class->member_IDs[class->numOfMembers][ID_STRING_SIZE-1] = '\0';
class->numOfMembers++;
}
Expand Down

0 comments on commit 4c1b3f3

Please sign in to comment.