X-Git-Url: https://git.deb.at/w?a=blobdiff_plain;f=misc.c;fp=misc.c;h=8a4b9cfc5d2657fbb8ed69076c849d88b1efa5f6;hb=efc9a360c599ac2317853a6ff3ca6c3d208b7316;hp=fa67f0c99a644942f26c2b43af43ca3f85282370;hpb=5d50b3ba7f2e35013e2236219b11fcf75a058770;p=pkg%2Fabook.git diff --git a/misc.c b/misc.c index fa67f0c..8a4b9cf 100644 --- a/misc.c +++ b/misc.c @@ -123,7 +123,7 @@ mkstr (const char *format, ... ) char* strconcat (const char *str, ...) { - int l; + unsigned long l; MY_VA_LOCAL_DECL; char *s, *concat; @@ -144,6 +144,8 @@ strconcat (const char *str, ...) #else malloc(l); #endif + if(concat == NULL) + return NULL; strcpy (concat, str); MY_VA_START(str); @@ -190,6 +192,8 @@ my_getcwd() if( (dir = (char *)malloc(size)) == NULL) return NULL; + + *dir = 0; while( getcwd(dir, size) == NULL && errno == ERANGE ) if( (dir = (char *)realloc(dir, size *=2)) == NULL)