Skip to content

Commit

Permalink
fixes to make it pass basic tests again
Browse files Browse the repository at this point in the history
  • Loading branch information
dormando committed Aug 22, 2024
1 parent 7c998e3 commit d96fe07
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
16 changes: 10 additions & 6 deletions proxy_mutator.c
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,6 @@ mut_step_n(rescodecopy) {

// TODO: take a string or number from that position.
mut_step_r(rescodecopy) {
struct mcp_mutator *mut = run->mut;
// FIXME: error propagation
// FIXME: can we do all the error handling in the totalling phase?
if (p->slen < 2) {
Expand Down Expand Up @@ -919,8 +918,8 @@ static int mcp_mutator_new(lua_State *L, enum mcp_mut_type type) {

// copy function pointers into the step so we don't have to skip
// around the much larger mcp_mut_entries at runtime.
mut->steps[x].n = mcp_mut_entries[st].n;
mut->steps[x].r = mcp_mut_entries[st].r;
mut->steps[scount].n = mcp_mut_entries[st].n;
mut->steps[scount].r = mcp_mut_entries[st].r;
}
lua_pop(L, 1); // drop t or nil
scount++;
Expand Down Expand Up @@ -968,12 +967,17 @@ static inline int _mcp_mut_run_assemble(struct mcp_mut_run *run, struct mcp_mut_
if (s->r(run, s, &parts[x]) < 0) {
assert(1 == 0);
}

*(run->d_pos) = ' ';
run->d_pos++;
}

// TODO: any cases where we need to check if the final char is a space or
// not?
// add the \r\n after all steps
*(run->d_pos) = '\r';
*(run->d_pos+1) = '\n';
run->d_pos += 2;
*(run->d_pos-1) = '\r';
*(run->d_pos) = '\n';
run->d_pos++;

return 0;
}
Expand Down
2 changes: 2 additions & 0 deletions t/proxymut.t
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,5 @@ sub test_mg {
$t->clear();
};
}

done_testing();

0 comments on commit d96fe07

Please sign in to comment.