Make sure C strings always end with a NULL.
Haven't bumped into any problems just yet. However, in theory all sorts of evil could happen here. Which is part of the problem of C: so much shit is undefined behaviour that you can take a single step and fall in 15 holes at the same time. In theory, because nobody bothered to actually specify it properly.
This commit is contained in:
parent
0299ff1ea4
commit
1400a859ce
|
@ -78,7 +78,7 @@ VALUE oga_xml_lexer_advance(VALUE self, VALUE data_block)
|
|||
/* Make sure that all data passed back to Ruby has the proper encoding. */
|
||||
rb_encoding *encoding = rb_enc_get(data_block);
|
||||
|
||||
char *data_str_val = StringValuePtr(data_block);
|
||||
char *data_str_val = StringValueCStr(data_block);
|
||||
|
||||
const char *p = data_str_val;
|
||||
const char *pe = data_str_val + strlen(data_str_val);
|
||||
|
|
Loading…
Reference in New Issue