diff options
author | Bastien Nocera <hadess@hadess.net> | 2018-06-13 18:00:37 +0200 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2018-06-13 18:01:06 +0200 |
commit | 76ea8d775cec900991c7c63e182583b42ca728f1 (patch) | |
tree | 2e1b8491771aa1833281890f278a860f7a02a747 | |
parent | e3dbebc93e8d02f725473e092fb12076f6900a53 (diff) | |
download | totem-pl-parser-76ea8d775cec900991c7c63e182583b42ca728f1.tar.gz |
core: Fix compile-time warnings in XML parser
plparse/xmllexer.c: In function ‘lexer_get_token_d_r’:
plparse/xmllexer.c:359:8: warning: ‘strncpy’ output truncated before terminating nul copying 7 bytes from a string of the same length [-Wstringop-truncation]
strncpy(tok + tok_pos, "DOCTYPE", 7); /* FIXME */
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
plparse/xmllexer.c:369:8: warning: ‘strncpy’ output truncated before terminating nul copying 7 bytes from a string of the same length [-Wstringop-truncation]
strncpy (tok + tok_pos, "[CDATA[", 7); /* FIXME */
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-rw-r--r-- | plparse/xmllexer.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/plparse/xmllexer.c b/plparse/xmllexer.c index c3633df..5679053 100644 --- a/plparse/xmllexer.c +++ b/plparse/xmllexer.c @@ -356,7 +356,7 @@ int lexer_get_token_d_r(struct lexer * lexer, char ** _tok, int * _tok_size, int case 'D': lexer->lexbuf_pos++; if (strncmp(lexer->lexbuf + lexer->lexbuf_pos, "OCTYPE", 6) == 0) { - strncpy(tok + tok_pos, "DOCTYPE", 7); /* FIXME */ + memcpy(tok + tok_pos, "DOCTYPE", strlen ("DOCTYPE")); lexer->lexbuf_pos += 6; return T_DOCTYPE_START; } else { @@ -366,7 +366,7 @@ int lexer_get_token_d_r(struct lexer * lexer, char ** _tok, int * _tok_size, int case '[': lexer->lexbuf_pos++; if (strncmp(lexer->lexbuf + lexer->lexbuf_pos, "CDATA[", 6) == 0) { - strncpy (tok + tok_pos, "[CDATA[", 7); /* FIXME */ + memcpy (tok + tok_pos, "[CDATA[", strlen ("[CDATA[")); lexer->lexbuf_pos += 6; lexer->lex_mode = CDATA; return T_CDATA_START; |