Patch for cmd.c

Andrew V. Samoilov andrew at email.zp.ua
Mon Oct 25 09:25:24 UTC 2004


Hi,
> 
> this patch fixes rare and almost impossible off-by-one.
> If user input is empty (""), these lines can do very bad thing:
> 
>     if (reg_exp_t [strlen(reg_exp_t) - 1] == PATH_SEP){
>         dirflag = 1;
>         reg_exp_t [strlen(reg_exp_t) - 1] = 0;
>     }
> 
> It is almoust impossible to meet PATH_SEP before '\0', but sometimes it happens.

Patch attached, sorry for inconvenience.

-- 
Regards,
Andrew V. Samoilov.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cmd.c.patch
URL: <http://lists.midnight-commander.org/pipermail/mc-devel/attachments/20041025/ec77a966/attachment.ksh>


More information about the mc-devel mailing list