Skip to content

Commit aaf4b5a

Browse files
committed
Avoid nullptr access and subsequent deref
1 parent 9ba8009 commit aaf4b5a

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

  • libCacheSim/include/libCacheSim

libCacheSim/include/libCacheSim/enum.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,17 @@ typedef enum {
8686
OP_INVALID = 255
8787
} req_op_e;
8888

89+
#define INV "invalid",
90+
#define INV_X16 INV INV INV INV INV INV INV INV INV INV INV INV INV INV INV INV
91+
#define INV_X64 INV_X16 INV_X16 INV_X16 INV_X16
92+
#define INV_X256 INV_X64 INV_X64 INV_X64 INV_X64
93+
8994
static const char* const req_op_str[OP_INVALID + 2] = {
90-
"nop", "get", "gets", "set", "add", "cas", "replace", "append",
91-
"prepend", "delete", "incr", "decr", "read", "write", "update", "invalid"};
95+
"nop", "get", "gets", "set",
96+
"add", "cas", "replace", "append",
97+
"prepend", "delete", "incr", "decr",
98+
"read", "write", "update", INV_X64 INV_X64 INV_X64 INV_X48,
99+
"invalid", "invalid"};
92100

93101
typedef enum { ERR, OK, MY_EOF } rstatus;
94102
static const char* const rstatus_str[3] = {"ERR", "OK", "MY_EOF"};

0 commit comments

Comments
 (0)