need va_end() after va_copy(); ok dtucker
spotted by Coverity
This commit is contained in:
parent
f703757234
commit
b36b162be5
|
@ -320,7 +320,7 @@ dopr(char *buffer, size_t maxlen, const char *format, va_list args_in)
|
||||||
value = va_arg (args, int);
|
value = va_arg (args, int);
|
||||||
if (fmtint(buffer, &currlen, maxlen,
|
if (fmtint(buffer, &currlen, maxlen,
|
||||||
value, 10, min, max, flags) == -1)
|
value, 10, min, max, flags) == -1)
|
||||||
return -1;
|
goto fail;
|
||||||
break;
|
break;
|
||||||
case 'o':
|
case 'o':
|
||||||
flags |= DP_F_UNSIGNED;
|
flags |= DP_F_UNSIGNED;
|
||||||
|
@ -340,7 +340,7 @@ dopr(char *buffer, size_t maxlen, const char *format, va_list args_in)
|
||||||
value = (long)va_arg (args, unsigned int);
|
value = (long)va_arg (args, unsigned int);
|
||||||
if (fmtint(buffer, &currlen, maxlen, value,
|
if (fmtint(buffer, &currlen, maxlen, value,
|
||||||
8, min, max, flags) == -1)
|
8, min, max, flags) == -1)
|
||||||
return -1;
|
goto fail;
|
||||||
break;
|
break;
|
||||||
case 'u':
|
case 'u':
|
||||||
flags |= DP_F_UNSIGNED;
|
flags |= DP_F_UNSIGNED;
|
||||||
|
@ -360,7 +360,7 @@ dopr(char *buffer, size_t maxlen, const char *format, va_list args_in)
|
||||||
value = (long)va_arg (args, unsigned int);
|
value = (long)va_arg (args, unsigned int);
|
||||||
if (fmtint(buffer, &currlen, maxlen, value,
|
if (fmtint(buffer, &currlen, maxlen, value,
|
||||||
10, min, max, flags) == -1)
|
10, min, max, flags) == -1)
|
||||||
return -1;
|
goto fail;
|
||||||
break;
|
break;
|
||||||
case 'X':
|
case 'X':
|
||||||
flags |= DP_F_UP;
|
flags |= DP_F_UP;
|
||||||
|
@ -382,7 +382,7 @@ dopr(char *buffer, size_t maxlen, const char *format, va_list args_in)
|
||||||
value = (long)va_arg (args, unsigned int);
|
value = (long)va_arg (args, unsigned int);
|
||||||
if (fmtint(buffer, &currlen, maxlen, value,
|
if (fmtint(buffer, &currlen, maxlen, value,
|
||||||
16, min, max, flags) == -1)
|
16, min, max, flags) == -1)
|
||||||
return -1;
|
goto fail;
|
||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
if (cflags == DP_C_LDOUBLE)
|
if (cflags == DP_C_LDOUBLE)
|
||||||
|
@ -391,7 +391,7 @@ dopr(char *buffer, size_t maxlen, const char *format, va_list args_in)
|
||||||
fvalue = va_arg (args, double);
|
fvalue = va_arg (args, double);
|
||||||
if (fmtfp(buffer, &currlen, maxlen, fvalue,
|
if (fmtfp(buffer, &currlen, maxlen, fvalue,
|
||||||
min, max, flags) == -1)
|
min, max, flags) == -1)
|
||||||
return -1;
|
goto fail;
|
||||||
break;
|
break;
|
||||||
case 'E':
|
case 'E':
|
||||||
flags |= DP_F_UP;
|
flags |= DP_F_UP;
|
||||||
|
@ -402,7 +402,7 @@ dopr(char *buffer, size_t maxlen, const char *format, va_list args_in)
|
||||||
fvalue = va_arg (args, double);
|
fvalue = va_arg (args, double);
|
||||||
if (fmtfp(buffer, &currlen, maxlen, fvalue,
|
if (fmtfp(buffer, &currlen, maxlen, fvalue,
|
||||||
min, max, flags) == -1)
|
min, max, flags) == -1)
|
||||||
return -1;
|
goto fail;
|
||||||
break;
|
break;
|
||||||
case 'G':
|
case 'G':
|
||||||
flags |= DP_F_UP;
|
flags |= DP_F_UP;
|
||||||
|
@ -413,7 +413,7 @@ dopr(char *buffer, size_t maxlen, const char *format, va_list args_in)
|
||||||
fvalue = va_arg (args, double);
|
fvalue = va_arg (args, double);
|
||||||
if (fmtfp(buffer, &currlen, maxlen, fvalue,
|
if (fmtfp(buffer, &currlen, maxlen, fvalue,
|
||||||
min, max, flags) == -1)
|
min, max, flags) == -1)
|
||||||
return -1;
|
goto fail;
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
DOPR_OUTCH(buffer, currlen, maxlen,
|
DOPR_OUTCH(buffer, currlen, maxlen,
|
||||||
|
@ -428,13 +428,13 @@ dopr(char *buffer, size_t maxlen, const char *format, va_list args_in)
|
||||||
if (min > 0 && max >= 0 && min > max) max = min;
|
if (min > 0 && max >= 0 && min > max) max = min;
|
||||||
if (fmtstr(buffer, &currlen, maxlen,
|
if (fmtstr(buffer, &currlen, maxlen,
|
||||||
strvalue, flags, min, max) == -1)
|
strvalue, flags, min, max) == -1)
|
||||||
return -1;
|
goto fail;
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
strvalue = va_arg (args, void *);
|
strvalue = va_arg (args, void *);
|
||||||
if (fmtint(buffer, &currlen, maxlen,
|
if (fmtint(buffer, &currlen, maxlen,
|
||||||
(long) strvalue, 16, min, max, flags) == -1)
|
(long) strvalue, 16, min, max, flags) == -1)
|
||||||
return -1;
|
goto fail;
|
||||||
break;
|
break;
|
||||||
#if we_dont_want_this_in_openssh
|
#if we_dont_want_this_in_openssh
|
||||||
case 'n':
|
case 'n':
|
||||||
|
@ -494,8 +494,11 @@ dopr(char *buffer, size_t maxlen, const char *format, va_list args_in)
|
||||||
else if (maxlen > 0)
|
else if (maxlen > 0)
|
||||||
buffer[maxlen - 1] = '\0';
|
buffer[maxlen - 1] = '\0';
|
||||||
}
|
}
|
||||||
|
va_end(args);
|
||||||
return currlen < INT_MAX ? (int)currlen : -1;
|
return currlen < INT_MAX ? (int)currlen : -1;
|
||||||
|
fail:
|
||||||
|
va_end(args);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
Loading…
Reference in New Issue