Skip to contentSkip to conversation

Chunk: fix stored checksums

PATCH Applied Pete Zaitcev 2 participants 2 messages Dec 21, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Chunk: fix stored checksums

Existing code writes checksums of something other than the object data. Fix by summing the object data.

---
 server/object.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

This seems too obvious... Where is the trap?

server/object.c +1 -1
diff -urpN -X dontdiff chunkd-m/server/object.c chunkd-tip/server/object.c
@@ -195,7 +195,7 @@ bool cli_evt_data_in(struct client *cli,
 			return cli_err(cli, che_InternalError, false);
 		}
 
-		SHA1_Update(&cli->out_hash, cli->req_ptr, bytes);
+		SHA1_Update(&cli->out_hash, p, bytes);
 
 		cli->out_len -= bytes;
 		p += bytes;
Applied
#1 lore raw
Quoted 10 lines · Pete Zaitcev

Existing code writes checksums of something other than the object data. Fix by summing the object data.

---
  server/object.c |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

This seems too obvious... Where is the trap?

applied... how embarrassing.

The C client definitely needs code to verify each checksum, too. The protocol is designed such that each side can verify checksums at each point in the process... but the implementations are clearly not at the design goal.

Jeff