Skip to content

Commit

Permalink
fix segfault
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitug committed Jan 9, 2013
1 parent 24ea360 commit 3abace3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions geoip.c
Expand Up @@ -43,6 +43,10 @@ void rb_hash_sset(VALUE hash, const char *str, VALUE v) {
/* pulled from http://blog.inventic.eu/?p=238 and /* pulled from http://blog.inventic.eu/?p=238 and
https://github.com/Vagabond/erlang-iconv/blob/master/c_src/iconv_drv.c */ https://github.com/Vagabond/erlang-iconv/blob/master/c_src/iconv_drv.c */
static VALUE encode_to_utf8_and_return_rb_str(char *value) { static VALUE encode_to_utf8_and_return_rb_str(char *value) {
if (value == NULL) {
return Qnil;
}

char dst[BUFSIZ]; char dst[BUFSIZ];
size_t srclen = strlen(value); size_t srclen = strlen(value);
size_t dstlen = srclen * 2; size_t dstlen = srclen * 2;
Expand Down

0 comments on commit 3abace3

Please sign in to comment.