summaryrefslogtreecommitdiff
path: root/proto_bin.c
diff options
context:
space:
mode:
authorkokke <spam@rowdy.dk>2021-09-08 20:07:29 +0200
committerdormando <dormando@rydia.net>2021-11-23 15:47:47 -0800
commit75e4d574b34c6e3b5dd9330acd61097b75cdf1d3 (patch)
tree5cf2a0e4308f05ae03c69d8a68360e5555ddcf15 /proto_bin.c
parentb95ca35702a9ba3cdd8e0ad66137f95dea71cbe7 (diff)
downloadmemcached-75e4d574b34c6e3b5dd9330acd61097b75cdf1d3.tar.gz
Fix time-of-check time-of-use bugs
Fixing 'bugs' of the pattern: 'assert(ptr != 0)' after 'ptr' was already dereferenced
Diffstat (limited to 'proto_bin.c')
-rw-r--r--proto_bin.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/proto_bin.c b/proto_bin.c
index a6bf520..b61c3bb 100644
--- a/proto_bin.c
+++ b/proto_bin.c
@@ -262,10 +262,10 @@ static void complete_incr_bin(conn *c, char *extbuf) {
char tmpbuf[INCR_MAX_STORAGE_LEN];
uint64_t cas = 0;
+ assert(c != NULL);
protocol_binary_response_incr* rsp = (protocol_binary_response_incr*)c->resp->wbuf;
protocol_binary_request_incr* req = (void *)extbuf;
- assert(c != NULL);
//assert(c->wsize >= sizeof(*rsp));
/* fix byteorder in the request */
@@ -1283,11 +1283,10 @@ static void process_bin_delete(conn *c) {
item *it;
uint32_t hv;
+ assert(c != NULL);
char* key = binary_get_key(c);
size_t nkey = c->binary_header.request.keylen;
- assert(c != NULL);
-
if (settings.verbose > 1) {
int ii;
fprintf(stderr, "Deleting ");