Browse Source

Gmt module: Fix potential segmentation fault.

ObjPtr
Michael Uleysky 9 years ago
parent
commit
79ab3b72a7
  1. 3
      modules/gmt/modgmt_internals.h

3
modules/gmt/modgmt_internals.h

@ -33,7 +33,8 @@ inline struct GMT_OPTION* str2options(void *api, const char* str, size_t size=0)
else else
{ {
t=static_cast<char*>(malloc(size+1)); t=static_cast<char*>(malloc(size+1));
memcpy(t,str,size+1); memcpy(t,str,size);
t[size]=0;
} }
struct GMT_OPTION* opts=GMT_Create_Options(api,0,t); struct GMT_OPTION* opts=GMT_Create_Options(api,0,t);
GMT_Append_Option(api,GMT_Create_Options(api,0,default_gmt_options),opts); GMT_Append_Option(api,GMT_Create_Options(api,0,default_gmt_options),opts);

Loading…
Cancel
Save