Skip to content
Browse files

fix segfault

  • Loading branch information...
1 parent 24ea360 commit 3abace3e18ca719a77a8b06a3e1448dd1677fff1 @nikitug committed Jan 9, 2013
Showing with 4 additions and 0 deletions.
  1. +4 −0 geoip.c
View
4 geoip.c
@@ -43,6 +43,10 @@ void rb_hash_sset(VALUE hash, const char *str, VALUE v) {
/* pulled from http://blog.inventic.eu/?p=238 and
https://github.com/Vagabond/erlang-iconv/blob/master/c_src/iconv_drv.c */
static VALUE encode_to_utf8_and_return_rb_str(char *value) {
+ if (value == NULL) {
+ return Qnil;
+ }
+
char dst[BUFSIZ];
size_t srclen = strlen(value);
size_t dstlen = srclen * 2;

0 comments on commit 3abace3

Please sign in to comment.
Something went wrong with that request. Please try again.