Skip to content

Commit 435d429

Browse files
Update jellyfish.c
1 parent f057182 commit 435d429

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

code/logic/jellyfish.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,14 +326,17 @@ int fossil_jellyfish_save(const fossil_jellyfish_chain *chain, const char *filep
326326
char output_escaped[FOSSIL_JELLYFISH_OUTPUT_SIZE * 2] = {0};
327327

328328
char *dst = input_escaped;
329-
for (const char *src = b->input; *src && (dst - input_escaped) < sizeof(input_escaped) - 2; ++src) {
329+
// Escape input
330+
char *dst = input_escaped;
331+
for (const char *src = b->input; *src && (size_t)(dst - input_escaped) < sizeof(input_escaped) - 2; ++src) {
330332
if (*src == '"' || *src == '\\') *dst++ = '\\';
331333
*dst++ = *src;
332334
}
333335
*dst = '\0';
334-
336+
337+
// Escape output
335338
dst = output_escaped;
336-
for (const char *src = b->output; *src && (dst - output_escaped) < sizeof(output_escaped) - 2; ++src) {
339+
for (const char *src = b->output; *src && (size_t)(dst - output_escaped) < sizeof(output_escaped) - 2; ++src) {
337340
if (*src == '"' || *src == '\\') *dst++ = '\\';
338341
*dst++ = *src;
339342
}

0 commit comments

Comments
 (0)