Thread (198 messages) 198 messages, 6 authors, 2025-06-20

Re: [PATCH 1/2] imap-send: fix bug causing cfg->folder being set to NULL

From: Jeff King <hidden>
Date: 2025-05-22 18:31:23

On Thu, May 22, 2025 at 02:25:47PM -0400, Eric Sunshine wrote:
It's subjective, but I would probably fix this a little bit
differently and (to my mind) more simply:

    response = cram(prompt, ctx->cfg->user, ctx->cfg->pass);

    ret = socket_write(&ctx->imap->buf.sock, response, strlen(response));
    free(response);
    if (ret != strlen(response))
        return error("IMAP error: sending response failed");
Doesn't that introduce a use-after-free for response? You'd have to
store the strlen() result in a local variable.

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help