commit | 8d50600d7d927a5c9f08c2a9573b6a45866dc602 | [log] [tgz] |
---|---|---|
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | Thu Jul 04 20:14:10 2013 +0200 |
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | Thu Jul 04 20:14:10 2013 +0200 |
tree | 09d9424bdcd9d0278640f999d44e70f1aac933c0 | |
parent | 047213b01e786c9765460fccd5f394e93fc777f1 [diff] |
get_value_string: Null terminate after the call to snprintf It is impossible that the snprintf will fill the entire namebuf but just follow the idiom to make sure it is null terminated. Related: Coverity CID 1040676
diff --git a/src/utils.c b/src/utils.c index c36979c..5874077 100644 --- a/src/utils.c +++ b/src/utils.c
@@ -31,6 +31,7 @@ } snprintf(namebuf, sizeof(namebuf), "unknown 0x%x", val); + namebuf[sizeof(namebuf) - 1] = '\0'; return namebuf; }