security: fix dereference in seclink
fix dereference after checking null
WGID : 390627
#define SL_ERR(fd) \
do { \
+ if (fd == -1) { \
+ SL_LOG(SL_TAG"%s:%d\n", __FILE__, __LINE__); \
+ } else { \
SL_LOG(SL_TAG"%s:%d ret(%d) code(%s)\n", \
__FILE__, __LINE__, fd, strerror(errno)); \
+ } \
} while (0)
#ifdef LINUX
@@ -137,7 +141,7 @@ int sl_deinit(sl_ctx hnd)
SL_ENTER;
if (!hnd || ((struct _seclink_s_ *)hnd)->fd <= 0) {
- SL_ERR(((struct _seclink_s_ *)hnd)->fd);
+ SL_ERR(-1);
return -1;
}
struct _seclink_s_ *sl = (struct _seclink_s_ *)hnd;
