[asterisk-bugs] [JIRA] (ASTERISK-28921) Wrong return value check for fwrite when writing to pcap file

Asterisk Team (JIRA) noreply at issues.asterisk.org
Fri May 29 00:38:25 CDT 2020


    [ https://issues.asterisk.org/jira/browse/ASTERISK-28921?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=250969#comment-250969 ] 

Asterisk Team commented on ASTERISK-28921:
------------------------------------------

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

> Wrong return value check for fwrite when writing to pcap file
> -------------------------------------------------------------
>
>                 Key: ASTERISK-28921
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-28921
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Resources/res_pjsip_logger
>    Affects Versions: 16.11.0
>            Reporter: nappsoft
>            Severity: Minor
>
> When using the new feature that logs to pcap files one will get 5 lines with warnings for each packet written.
> This is because of the fact that the wrong return value is being checked: fwrite does not return the number of bytes written, but the number of elements written. However asterisk is comparing the return value (which will always be 1) with the size of the element, resulting in the following output:
> [May 29 07:22:23] WARNING[7274]: res_pjsip_logger.c:250 pjsip_logger_write_to_pcap: Writing PCAP header failed: Invalid argument
> [May 29 07:22:23] WARNING[7274]: res_pjsip_logger.c:253 pjsip_logger_write_to_pcap: Writing ethernet header to pcap failed: Invalid argument
> [May 29 07:22:23] WARNING[7274]: res_pjsip_logger.c:256 pjsip_logger_write_to_pcap: Writing IP header to pcap failed: Invalid argument
> [May 29 07:22:23] WARNING[7274]: res_pjsip_logger.c:259 pjsip_logger_write_to_pcap: Writing UDP header to pcap failed: Invalid argument
> [May 29 07:22:23] WARNING[7274]: res_pjsip_logger.c:262 pjsip_logger_write_to_pcap: Writing UDP payload to pcap failed: Invalid argument
> The attached patch fixes this.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list