Skip to content

Commit 815e9d6

Browse files
committed
Merge pull request #418 from shyouhei/master
Avoid buffer overrun
2 parents 2f84939 + ff722f5 commit 815e9d6

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

ext/mysql2/result.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ static VALUE mysql2_set_field_string_encoding(VALUE val, MYSQL_FIELD field, rb_e
157157
/* if binary flag is set, respect it's wishes */
158158
if (field.flags & BINARY_FLAG && field.charsetnr == 63) {
159159
rb_enc_associate(val, binaryEncoding);
160+
} else if (!field.charsetnr) {
161+
rb_enc_associate(val, binaryEncoding);
160162
} else {
161163
/* lookup the encoding configured on this field */
162164
const char *enc_name;

0 commit comments

Comments
 (0)