On Tue, Mar 28, 2017 at 03:07:12AM -0400, Jeff King wrote: > It took me a while to find it. This is the switch from "len == 48" to > "len > 8" when matching "shallow" lines. I think this makes sense. > > > Note that in queue_command we are guaranteed to have a NUL-terminated > > buffer or at least one byte of overflow that we can safely read, so the > > linelen check can be elided. We would die in such a case, but not read > > invalid memory. > > I think linelen is always just strlen(line). Since the queue_command > function no longer cares about it, perhaps we can just omit it? I've just looked at this to put in a fix, and I don't agree. We are guaranteed that we'll have overflow, but linelen can point to a newline, not just a NUL, so it isn't always strlen(line). This is the case in queue_commands_from_cert. We do use this value, in computing the reflen value, so I think it's better to keep it for now. I agree that a future refactor could convert it to be NUL-terminated, but I'd rather not make that change here. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | https://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: https://keybase.io/bk2204