(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-memcache.c) |
| |
| 1294 | | | memcache_response_dissector (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, |
| 1295 | | | const guchar *line, const guchar *lineend, guint8 opcode) |
| 1296 | | | { |
| 1297 | | | const guchar *next_token; |
| 1298 | | | int tokenlen; |
| 1299 | | | |
| 1300 | | | switch (opcode) { |
| 1301 | | | |
| 1302 | | | case OP_GET: |
| 1303 | | | case OP_GETS: |
| 1304 | | | return get_response_dissector (tvb, pinfo, tree, offset); |
| 1305 | | | |
| 1306 | | | case OP_VERSION: |
| 1307 | | | |
| 1308 | | | tokenlen = get_token_len (line, lineend, &next_token); |
| 1309 | | | if (tokenlen == 0) { |
| 1310 | | | return -1; |
| 1311 | | | } |
| 1312 | | | if ((tokenlen == 7) && strncmp (line, "VERSION", tokenlen) == 0) { |
| 1313 | | | offset += (int) (next_token - line); |
| 1314 | | | line = next_token; |
| 1315 | | | } else { |
| 1316 | | | return -1; |
| 1317 | | | } |
| 1318 | | | |
| 1319 | | | |
| 1320 | | | tokenlen = get_token_len (line, lineend, &next_token); |
| 1321 | | | if (tokenlen == 0) { |
| 1322 | | | |
| 1323 | | | return -1; |
| 1324 | | | } |
| 1325 | | | |
| 1326 | | | proto_tree_add_item (tree, hf_version, tvb, offset, tokenlen, FALSE); |
| 1327 | | | offset += (int) (next_token - line); |
| 1328 | | | line = next_token; |
| 1329 | | | |
| 1330 | | | |
| 1331 | | | tokenlen = get_token_len (line, lineend, &next_token); |
| 1332 | | | if (tokenlen == 0) { |
| 1333 | | | return offset; |
| 1334 | | | } else { |
| 1335 | | | |
| 1336 | | | return -1; |
| 1337 | | | } |
| 1338 | | | |
| 1339 | | | return offset; |
Unreachable Data Flow
The highlighted code will not execute under any circumstances. This may be because of: |
|
| 1340 | | | |
| 1341 | | | case OP_STAT: |
| 1342 | | | return stat_dissector (tvb, tree, offset); |
| 1343 | | | |
| 1344 | | | default: |
| 1345 | | | break; |
| 1346 | | | } |
| 1347 | | | |
| 1348 | | | |
| 1349 | | | tokenlen = get_token_len (line, lineend, &next_token); |
| 1350 | | | if (tokenlen == 0) { |
| 1351 | | | return -1; |
| 1352 | | | } |
| 1353 | | | |
| 1354 | | | |
| 1355 | | | |
| 1356 | | | |
| 1357 | | | |
| 1358 | | | |
| 1359 | | | if ((tokenlen == 6 && strncmp (line, "STORED", tokenlen) == 0) || |
| 1360 | | | (tokenlen == 10 && strncmp (line, "NOT_STORED", tokenlen) == 0) || |
| 1361 | | | (tokenlen == 6 && strncmp (line, "EXISTS", tokenlen) == 0) || |
| 1362 | | | (tokenlen == 9 && strncmp (line, "NOT_FOUND", tokenlen) == 0) || |
| 1363 | | | (tokenlen == 7 && strncmp (line, "DELETED", tokenlen) == 0) || |
| 1364 | | | (tokenlen == 2 && strncmp (line, "OK", tokenlen) == 0) || |
| 1365 | | | (tokenlen == 3 && strncmp (line, "END", tokenlen) == 0)) |
| 1366 | | | { |
| 1367 | | | proto_tree_add_item (tree, hf_response, tvb, offset, tokenlen, FALSE); |
| 1368 | | | offset += (int) (next_token - line); |
| 1369 | | | line = next_token; |
| 1370 | | | return offset; |
| 1371 | | | } |
| 1372 | | | |
| 1373 | | | |
| 1374 | | | |
| 1375 | | | |
| 1376 | | | |
| 1377 | | | |
| 1378 | | | |
| 1379 | | | |
| 1380 | | | if (opcode == OP_INCREMENT) { |
| 1381 | | | return incr_dissector (tvb, tree, offset); |
| 1382 | | | } |
| 1383 | | | |
| 1384 | | | return offset; |
| 1385 | | | } |
| |