Thread: [patch] fix buffer overrun in logging, and code cleanup

[patch] fix buffer overrun in logging, and code cleanup

From
"Tsunakawa, Takayuki"
Date:
Hello,

While I was troubleshooting some user problem and trying to figure out why mylog_xxx.log is not created, I found a tiny
bug. The buffers for holding the full path for MyLog and CommLog are small -- only 80 bytes.  If you specify a long
pathfor Logdir, the buffer overrun occurs.  Please find the attached patch mylog_buffer_overrun.patch. 

The other patch mylog_cleanup.patch removes code which are unused or unnecessary anymore.  I'd like to make the code as
leanas possible, so that it makes code reading and searching easier and faster.  This patch removes about 120 lines. 

Regards
Takayuki Tsunakawa


Attachment

Re: [patch] fix buffer overrun in logging, and code cleanup

From
"Inoue, Hiroshi"
Date:
Hi,

I would examine the patch.
However forcelog() exists in msdtc_enlist.cpp at first glance.

regards,
Hiroshi Inoue

On 2016/05/26 11:40, Tsunakawa, Takayuki wrote:
> Hello,
>
> While I was troubleshooting some user problem and trying to figure out why mylog_xxx.log is not created, I found a
tinybug.  The buffers for holding the full path for MyLog and CommLog are small -- only 80 bytes.  If you specify a
longpath for Logdir, the buffer overrun occurs.  Please find the attached patch mylog_buffer_overrun.patch. 
>
> The other patch mylog_cleanup.patch removes code which are unused or unnecessary anymore.  I'd like to make the code
aslean as possible, so that it makes code reading and searching easier and faster.  This patch removes about 120 lines. 
>
> Regards
> Takayuki Tsunakawa


Re: [patch] fix buffer overrun in logging, and code cleanup

From
"Tsunakawa, Takayuki"
Date:
> From: Inoue, Hiroshi [mailto:h-inoue@dream.email.ne.jp]
> However forcelog() exists in msdtc_enlist.cpp at first glance.

Oh, I overlooked it.  I removed the use of forcelog() there by:

1) Remove #ifdef _LOCK_DEBUG ... #endif code fragments.
2) Replace remaining forcelog() call sites with mylog().  I think mylog() should be used to allow users of the log file
accumulation.

Regards
Takayuki Tsunakawa



Attachment