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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Aditya Garg <gargaditya08@xxxxxxxx> writes:

> Upon setting up imap-send config file, I encountered the very first bug.
> An error showing "no imap store specified" was being displayed on the
> terminal. Upon investigating further, in static int git_imap_config,
> cfg->folder was being incorrectly set to NULL in case imap.user, imap.pass,
> imap.tunnel and imap.authmethod were defined. Because of this, git imap-send
> was basically not usable at all. The bug seems to be there for quite a while,
> and has not yet been detected, likely due to better options like git send-email
> being available.
>
> Fixes: 6d1f198f34 (imap-send: fix leaking memory in `imap_server_conf`, 2024-06-07)

This project frowns upon this trailer.  One reason is that it may
later turn out that this does not fix ;-) And no, this is to suggest
using "attempts-to-fix" or anything of that sort.  Most other
trailers are declaration of facts.  "Fixes:" is not.

Also, in the long run, first-person experience of an author is not
all that interesting to "git log" readers.  "I did this, I saw that"
is something we try not to use too often.

Rather, flow it in the problem description, perhaps like

    6d1f198f (imap-send: fix leaking memory in `imap_server_conf`,
    2024-06-07) broken imap-send with mistaken copy-and-paste and
    cleared cfg->folder when it should have cleared other members in
    the structure the code is about to overwrite.  git-imap-send
    since Git 2.46.0 is unusable due to this bug.

or something to start the description.


> Signed-off-by: Aditya Garg <gargaditya08@xxxxxxxx>
> ---
>  imap-send.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/imap-send.c b/imap-send.c
> index 27dc033c7f..37f94a37e8 100644
> --- a/imap-send.c
> +++ b/imap-send.c
> @@ -1316,16 +1316,16 @@ static int git_imap_config(const char *var, const char *val,
>  		FREE_AND_NULL(cfg->folder);
>  		return git_config_string(&cfg->folder, var, val);
>  	} else if (!strcmp("imap.user", var)) {
> -		FREE_AND_NULL(cfg->folder);
> +		FREE_AND_NULL(cfg->user);
>  		return git_config_string(&cfg->user, var, val);
>  	} else if (!strcmp("imap.pass", var)) {
> -		FREE_AND_NULL(cfg->folder);
> +		FREE_AND_NULL(cfg->pass);
>  		return git_config_string(&cfg->pass, var, val);
>  	} else if (!strcmp("imap.tunnel", var)) {
> -		FREE_AND_NULL(cfg->folder);
> +		FREE_AND_NULL(cfg->tunnel);
>  		return git_config_string(&cfg->tunnel, var, val);
>  	} else if (!strcmp("imap.authmethod", var)) {
> -		FREE_AND_NULL(cfg->folder);
> +		FREE_AND_NULL(cfg->auth_method);
>  		return git_config_string(&cfg->auth_method, var, val);
>  	} else if (!strcmp("imap.port", var)) {
>  		cfg->port = git_config_int(var, val, ctx->kvi);




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux