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:
Yorick Peterse 2014-09-28 22:28:55 +02:00
parent 0299ff1ea4
commit 1400a859ce
1 changed files with 1 additions and 1 deletions

View File

@ -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);