diff options
| author | Pablo Neira Ayuso <pablo@gnumonks.org> | 2011-05-03 22:32:48 +0200 | 
|---|---|---|
| committer | Harald Welte <laforge@gnumonks.org> | 2011-05-04 11:07:13 +0200 | 
| commit | 534ba8132818524bdf52d5dcf249dda51f766efb (patch) | |
| tree | 93620569e4e3ba32fa8a5f7cdbb480577ba17854 /src | |
| parent | 81e9636454294ae10ef9bc8bf149dd0248afce76 (diff) | |
logging: make sure the output is null-terminated
If we reach the buffer size or snprintf fails, we want to make sure
that the output is null-terminated.
Diffstat (limited to 'src')
| -rw-r--r-- | src/logging.c | 2 | 
1 files changed, 2 insertions, 0 deletions
| diff --git a/src/logging.c b/src/logging.c index 6797afcd..0911010a 100644 --- a/src/logging.c +++ b/src/logging.c @@ -493,6 +493,7 @@ const char *log_vty_command_string(const struct log_info *info)  		goto err;  	OSMO_SNPRINTF_RET(ret, rem, offset, len);  err: +	str[size-1] = '\0';  	return str;  } @@ -544,6 +545,7 @@ const char *log_vty_command_description(const struct log_info *info)  		OSMO_SNPRINTF_RET(ret, rem, offset, len);  	}  err: +	str[size-1] = '\0';  	return str;  } | 
