ref: 1a88ade6f51bd413390f6f4b8ece7c96828105c8
parent: 31ff354ea65c8f0904ecec1842abdc9df650ba18
author: Ori Bernstein <[email protected]>
date: Mon Feb 26 19:09:13 EST 2024
freplay: fix off-by-one in size, use /mnt instead of /n
--- a/test/freplay.c
+++ b/test/freplay.c
@@ -6,7 +6,7 @@
File* ctlfile;
File* datfile;
-char* mountpt = "/n/replay";
+char* mountpt = "/mnt/replay";
char* srvname = "replay";
char* logfile;
char* replayfile;
@@ -75,10 +75,14 @@
fswrite(Req *r)
{
if(r->fid->file == datfile){
- if(logfile == nil)
+ if(logfile == nil){
respond(r, "read-only replay file: no log defined");
- if(r->ifcall.offset + r->ifcall.count >= membufsz)
+ return;
+ }
+ if(r->ifcall.offset + r->ifcall.count > membufsz){
respond(r, "operation exceeds file size");
+ return;
+ }
log1(logfd, r->ifcall.data, r->ifcall.offset, r->ifcall.count);
memcpy(membuf + r->ifcall.offset, r->ifcall.data, r->ifcall.count);
r->ofcall.count = r->ifcall.count;