commit | 534ba8132818524bdf52d5dcf249dda51f766efb | [log] [tgz] |
---|---|---|
author | Pablo Neira Ayuso <pablo@gnumonks.org> | Tue May 03 22:32:48 2011 +0200 |
committer | Harald Welte <laforge@gnumonks.org> | Wed May 04 11:07:13 2011 +0200 |
tree | 93620569e4e3ba32fa8a5f7cdbb480577ba17854 | |
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.
diff --git a/src/logging.c b/src/logging.c index 6797afc..0911010 100644 --- a/src/logging.c +++ b/src/logging.c
@@ -493,6 +493,7 @@ goto err; OSMO_SNPRINTF_RET(ret, rem, offset, len); err: + str[size-1] = '\0'; return str; } @@ -544,6 +545,7 @@ OSMO_SNPRINTF_RET(ret, rem, offset, len); } err: + str[size-1] = '\0'; return str; }