\r
};\r
\r
+// Trust nobody\r
+#define STRLEN_MIN 16\r
+\r
+unsigned int safe_strlen(const char *s){\r
+ unsigned int size=0;\r
+ while(s[size])size++;\r
+ if(size<STRLEN_MIN)return STRLEN_MIN;\r
+ else return size;\r
+}\r
+\r
Quest::Quest(const char *t,const char *d,struct item_t r){\r
- strcpy((title=(char *)malloc(strlen(t))),t);\r
- strcpy((desc =(char *)malloc(strlen(d))),d);\r
+ title=(char *)calloc(safe_strlen(t),sizeof(char));\r
+ desc=(char *)calloc(safe_strlen(d),sizeof(char));\r
+ strcpy(title,t);\r
+ strcpy(desc,d);\r
memcpy(&reward,&r,sizeof(struct item_t));\r
}\r
\r