Skip to content

Commit

Permalink
Fixed buffer overflow when doing strcp on cdata
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgray committed Jul 21, 2011
1 parent 9163f5f commit 664243f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion c_src/exml.c
Expand Up @@ -58,7 +58,7 @@ void *character_data_handler(expat_parser *parser_data, const XML_Char *s, int l
ErlNifBinary cdata;

enif_alloc_binary(len, &cdata);
strcpy((char *) cdata.data, (const char *)s);
strncpy((char *)cdata.data, (const char *)s, len);

ERL_NIF_TERM event = enif_make_tuple(parser_data->env, 2,
enif_make_atom(parser_data->env, "xml_cdata"),
Expand Down

0 comments on commit 664243f

Please sign in to comment.