ladishd: max_escaped_length()
This commit is contained in:
parent
a608c373e6
commit
5b8fe165d3
|
@ -50,7 +50,7 @@ write_jack_parameter(
|
|||
{
|
||||
const char * src;
|
||||
char * dst;
|
||||
char path[JACK_CONF_MAX_ADDRESS_SIZE * 3]; /* encode each char in three bytes (percent encoding) */
|
||||
char path[max_escaped_length(JACK_CONF_MAX_ADDRESS_SIZE)];
|
||||
const char * content;
|
||||
char valbuf[100];
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/*
|
||||
* LADI Session Handler (ladish)
|
||||
*
|
||||
* Copyright (C) 2009 Nedko Arnaudov <nedko@arnaudov.name>
|
||||
* Copyright (C) 2009, 2010 Nedko Arnaudov <nedko@arnaudov.name>
|
||||
*
|
||||
**************************************************************************
|
||||
* This file contains the prototypes of the escape helper functions
|
||||
|
@ -32,4 +32,7 @@
|
|||
void escape(const char ** src_ptr, char ** dst_ptr);
|
||||
size_t unescape(const char * src, size_t src_len, char * dst);
|
||||
|
||||
/* encode each char in three bytes (percent encoding) */
|
||||
#define max_escaped_length(unescaped_length) ((unescaped_length) * 3)
|
||||
|
||||
#endif /* #ifndef ESCAPE_H__FABBE484_1093_41C1_9FC9_62ED0106E542__INCLUDED */
|
||||
|
|
|
@ -427,7 +427,7 @@ ladish_save_app(
|
|||
|
||||
ret = false;
|
||||
|
||||
escaped_buffer = malloc(ladish_max(strlen(name), strlen(command)) * 3 + 1); /* encode each char in three bytes (percent encoding) */
|
||||
escaped_buffer = malloc(max_escaped_length(ladish_max(strlen(name), strlen(command))) + 1);
|
||||
if (escaped_buffer == NULL)
|
||||
{
|
||||
log_error("malloc() failed.");
|
||||
|
|
Loading…
Reference in New Issue