etr / libhttpserver

C++ library for creating an embedded Rest HTTP server (and more)
GNU Lesser General Public License v2.1
882 stars 184 forks source link

[BUG] httpserver::error_log ignores argument it is supposed to printf format. #297

Closed bcsgh closed 1 year ago

bcsgh commented 1 year ago

Prerequisites

Description

httpserver::error_log is called in a context where it's expected to act link printf and format the passed argument list. Currently it just ignores it.

Steps to Reproduce

  1. build a server that uses https
  2. turn on logging via httpserver::create_webserver::debug() and `httpserver::create_webserver::log_error(...)'
  3. feed mismatch cert and key files (just one example)

Expected behavior: A log message explaining the issue.

Actual behavior: A format string like GnuTLS failed to setup x509 certificate/key: %s without the error message from gnutls_strerror e.g. https://github.com/Karlson2k/libmicrohttpd/blob/a0cb931f0c158f27ed297ad04e0a3c267adca271/src/microhttpd/daemon.c#L602

Reproduces how often: 100% (Somewhere between 10%-30% of error messages use formatting.)

Versions

Additional Information

I've got a PR ready to go.