-/* $OpenBSD: err_prn.c,v 1.20 2023/07/07 13:54:45 beck Exp $ */
+/* $OpenBSD: err_prn.c,v 1.21 2024/01/10 14:22:53 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* [including the GNU Public Licence.]
*/
+#include <limits.h>
#include <stdio.h>
#include <string.h>
static int
print_fp(const char *str, size_t len, void *fp)
{
- BIO bio;
-
- BIO_set(&bio, BIO_s_file());
- BIO_set_fp(&bio, fp, BIO_NOCLOSE);
-
- return BIO_printf(&bio, "%s", str);
+ if (len > INT_MAX)
+ return -1;
+ return fprintf(fp, "%.*s", (int)len, str);
}
void