diff options
author | Don Brady <[email protected]> | 2018-02-20 12:19:42 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2018-02-20 11:19:42 -0800 |
commit | cbce58135341d470c3a57e343bebe253384e1198 (patch) | |
tree | cf52686aa6a4fd1d75845506618870edf61a249d /include/sys/lua | |
parent | 7b30ee6bafe91ebd3b34433ef3b943fd07a98cea (diff) |
Fix coverity defects: zfs channel programs
CID 173243, 173245: Memory - corruptions (OVERRUN)
Added size argument to lcompat_sprintf() to avoid use of INT_MAX
CID 173244: Integer handling issues (OVERFLOW_BEFORE_WIDEN)
Added cast to uint64_t to avoid a 32 bit overflow warning
CID 173242: Integer handling issues (CONSTANT_EXPRESSION_RESULT)
Conditionally removed unused luai_numisnan() floating point check
CID 173241: Resource leaks (RESOURCE_LEAK)
Added missing close(fd) on error path
CID 173240: (UNINIT)
Fixed uninitialized variable in get_special_prop()
CID 147560: Null pointer dereferences (NULL_RETURNS)
Cleaned up bad code merge in dsl_dataset_promote_check()
CID 28475: Memory - illegal accesses (OVERRUN)
Fixed lcompat_sprintf() to use a size paramater
CID 28418, 28422: Error handling issues (CHECKED_RETURN)
Added function result cast to (void) to avoid warning
CID 23935, 28411, 28412: Memory - corruptions (ARRAY_VS_SINGLETON)
Added casts to avoid exposing result as an array
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Don Brady <[email protected]>
Closes #7181
Diffstat (limited to 'include/sys/lua')
-rw-r--r-- | include/sys/lua/luaconf.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/include/sys/lua/luaconf.h b/include/sys/lua/luaconf.h index 835d9ccfe..302c57a8c 100644 --- a/include/sys/lua/luaconf.h +++ b/include/sys/lua/luaconf.h @@ -12,7 +12,7 @@ #include <sys/zfs_context.h> -extern ssize_t lcompat_sprintf(char *, const char *, ...); +extern ssize_t lcompat_sprintf(char *, size_t size, const char *, ...); extern int64_t lcompat_strtoll(const char *, char **); extern int64_t lcompat_pow(int64_t, int64_t); @@ -402,9 +402,10 @@ extern int64_t lcompat_pow(int64_t, int64_t); #define PRId64 "lld" #endif -#define LUA_NUMBER_FMT "%" PRId64 -#define lua_number2str(s,n) lcompat_sprintf((s), LUA_NUMBER_FMT, (n)) #define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */ +#define LUA_NUMBER_FMT "%" PRId64 +#define lua_number2str(s,n) \ + lcompat_sprintf((s), LUAI_MAXNUMBER2STR, LUA_NUMBER_FMT, (n)) /* |