aboutsummaryrefslogtreecommitdiffstats
path: root/printf.c
diff options
context:
space:
mode:
Diffstat (limited to 'printf.c')
-rw-r--r--printf.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/printf.c b/printf.c
index 50af893..d71665f 100644
--- a/printf.c
+++ b/printf.c
@@ -464,7 +464,8 @@ static int _vsnprintf(out_fct_type out, char* buffer, const size_t maxlen, const
precision = _atoi(&format);
}
else if (*format == '*') {
- precision = (unsigned int)va_arg(va, int);
+ const int prec = (int)va_arg(va, int);
+ precision = prec > 0 ? (unsigned int)prec : 0U;
format++;
}
}