fix missing NULL termination on array

This commit is contained in:
Christian Grothoff 2020-03-01 13:44:13 +01:00
parent f457e1332d
commit 440c3dc1f0
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
3 changed files with 37 additions and 37 deletions

View File

@ -54,8 +54,7 @@ enum TALER_MHD_GlobalOptions
/** /**
* Set global options for response generation * Set global options for response generation within libtalermhd.
* within libtalermhd.
* *
* @param go global options to use * @param go global options to use
*/ */
@ -64,9 +63,8 @@ TALER_MHD_setup (enum TALER_MHD_GlobalOptions go);
/** /**
* Add headers we want to return in every response. * Add headers we want to return in every response. Useful for testing, like
* Useful for testing, like if we want to always close * if we want to always close connections.
* connections.
* *
* @param response response to modify * @param response response to modify
*/ */
@ -372,11 +370,10 @@ TALER_MHD_open_unix_path (const char *unix_path,
/** /**
* Bind a listen socket to the UNIX domain path * Bind a listen socket to the UNIX domain path or the TCP port and IP address
* or the TCP port and IP address as specified * as specified in @a cfg in section @a section. IF only a port was
* in @a cfg in section @a section. IF only a * specified, set @a port and return -1. Otherwise, return the bound file
* port was specified, set @a port and return -1. * descriptor.
* Otherwise, return the bound file descriptor.
* *
* @param cfg configuration to parse * @param cfg configuration to parse
* @param section configuration section to use * @param section configuration section to use
@ -398,10 +395,9 @@ struct TALER_MHD_Legal;
/** /**
* Load set of legal documents as specified in * Load set of legal documents as specified in @a cfg in section @a section
* @a cfg in section @a section where the Etag * where the Etag is given under the @param tagoption and the directory under
* is given under the @param tagoption and the * the @a diroption.
* directory under the @a diroption.
* *
* @param cfg configuration to use * @param cfg configuration to use
* @param section section to load values from * @param section section to load values from

View File

@ -49,25 +49,30 @@ TALER_MHD_parse_config (const struct GNUNET_CONFIGURATION_Handle *cfg,
char **unix_path, char **unix_path,
mode_t *unix_mode) mode_t *unix_mode)
{ {
const char *choices[] = {"tcp", "unix"}; const char *choices[] = {
"tcp",
"unix",
NULL
};
const char *serve_type; const char *serve_type;
unsigned long long port; unsigned long long port;
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_choice (cfg, GNUNET_CONFIGURATION_get_value_choice (cfg,
section, section,
"serve", "SERVE",
choices, choices,
&serve_type)) &serve_type))
{ {
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
section, section,
"serve", "SERVE",
"serve type required"); "serve type (tcp or unix) required");
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
if (0 == strcasecmp (serve_type, "tcp")) if (0 == strcasecmp (serve_type,
"tcp"))
{ {
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_number (cfg, GNUNET_CONFIGURATION_get_value_number (cfg,
@ -77,7 +82,7 @@ TALER_MHD_parse_config (const struct GNUNET_CONFIGURATION_Handle *cfg,
{ {
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
section, section,
"port", "PORT",
"port number required"); "port number required");
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
@ -87,15 +92,16 @@ TALER_MHD_parse_config (const struct GNUNET_CONFIGURATION_Handle *cfg,
{ {
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
section, section,
"port", "PORT",
"value not in [1,65535]"); "port number not in [1,65535]");
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
*rport = (uint16_t) port; *rport = (uint16_t) port;
*unix_path = NULL; *unix_path = NULL;
return GNUNET_OK; return GNUNET_OK;
} }
if (0 == strcmp (serve_type, "unix")) if (0 == strcmp (serve_type,
"unix"))
{ {
struct sockaddr_un s_un; struct sockaddr_un s_un;
char *modestring; char *modestring;
@ -103,13 +109,13 @@ TALER_MHD_parse_config (const struct GNUNET_CONFIGURATION_Handle *cfg,
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_filename (cfg, GNUNET_CONFIGURATION_get_value_filename (cfg,
section, section,
"unixpath", "UNIXPATH",
unix_path)) unix_path))
{ {
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
section, section,
"unixpath", "UNIXPATH",
"unixpath required"); "UNIXPATH value required");
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
if (strlen (*unix_path) >= sizeof (s_un.sun_path)) if (strlen (*unix_path) >= sizeof (s_un.sun_path))
@ -291,11 +297,10 @@ TALER_MHD_open_unix_path (const char *unix_path,
/** /**
* Bind a listen socket to the UNIX domain path * Bind a listen socket to the UNIX domain path or the TCP port and IP address
* or the TCP port and IP address as specified * as specified in @a cfg in section @a section. IF only a port was
* in @a cfg in section @a section. IF only a * specified, set @a port and return -1. Otherwise, return the bound file
* port was specified, set @a port and return -1. * descriptor.
* Otherwise, return the bound file descriptor.
* *
* @param cfg configuration to parse * @param cfg configuration to parse
* @param section configuration section to use * @param section configuration section to use

View File

@ -148,8 +148,8 @@ language_matches (const char *language_pattern,
/** /**
* Generate a response with a legal document in * Generate a response with a legal document in the format and language of the
* the format and language of the user's choosing. * user's choosing.
* *
* @param conn HTTP connection to handle * @param conn HTTP connection to handle
* @param legal legal document to serve * @param legal legal document to serve
@ -507,10 +507,9 @@ load_language (struct TALER_MHD_Legal *legal,
/** /**
* Load set of legal documents as specified in * Load set of legal documents as specified in @a cfg in section @a section
* @a cfg in section @a section where the Etag * where the Etag is given under the @param tagoption and the directory under
* is given under the @param tagoption and the * the @a diroption.
* directory under the @a diroption.
* *
* @param cfg configuration to use * @param cfg configuration to use
* @param section section to load values from * @param section section to load values from