X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=misc.c;h=5ff403d6b495f60ef9f8a7daf7a7075ef28b5693;hb=145ecf611238c4f1e39d89d3eee40319a2c54fe8;hp=618ca2971d0646fc7a889e4a65bd97edbad0b27f;hpb=fa7b23ce9025daba08e86bb934fc430099792b9a;p=PuTTY.git diff --git a/misc.c b/misc.c index 618ca297..5ff403d6 100644 --- a/misc.c +++ b/misc.c @@ -412,7 +412,7 @@ char *dupvprintf(const char *fmt, va_list ap) size = 512; while (1) { -#ifdef _WINDOWS +#if defined _WINDOWS && _MSC_VER < 1900 /* 1900 == VS2015 has real snprintf */ #define vsnprintf _vsnprintf #endif #ifdef va_copy @@ -460,7 +460,7 @@ char *fgetline(FILE *fp) int size = 512, len = 0; while (fgets(ret + len, size - len, fp)) { len += strlen(ret + len); - if (ret[len-1] == '\n') + if (len > 0 && ret[len-1] == '\n') break; /* got a newline, we're done */ size = len + 512; ret = sresize(ret, size, char);