droe / sslsplit

Transparent SSL/TLS interception
https://www.roe.ch/SSLsplit
BSD 2-Clause "Simplified" License
1.75k stars 328 forks source link

Missing error checks about function time(), gmtime() and strftime() #274

Open lc3412 opened 4 years ago

lc3412 commented 4 years ago

Hi,

I notice that funtion time(), gmtime() and strftime() are frequently used in the log.c. Here is an example of the usages, as shown in the following code, function time(), gmtime() and strftime() are do the handling actions when errors occur. So I think error handling towards these functions might be preferred. https://github.com/droe/sslsplit/blob/9bac829b7f62252a8958b60c96f8f4b11125fcc9/log.c#L634-L650

==============================================================================

However, in the other call sites of the same file, there exists several missing checks of function time(), gmtime() or strftime(). For example, as shown in the following code: https://github.com/droe/sslsplit/blob/9bac829b7f62252a8958b60c96f8f4b11125fcc9/log.c#L563-L565

sonertari commented 4 years ago

Yes, you can find such cases where we don't check the return values of system calls. Perhaps we should check them too.

lc3412 commented 4 years ago

Thank you very much for your patience in responding me about the Error Handling Proposals. As you said, other cases about missing error code checks are also found. However, sometimes it is confusing to figure out whether such cases are necessary to be repaired. Especially, as shown above, in the same project, some cases are handled properly but others are not.