Modify

Ticket #4201 (closed Bugs: fixed)

Opened 4 years ago

Last modified 4 years ago

boost/asio/detail/socket_ops.hpp:1305: isdigit called with char, not unsigned char

Reported by: anonymous Owned by: chris_kohlhoff
Milestone: Boost 1.43.0 Component: asio
Version: Boost 1.43.0 Severity: Problem
Keywords: Cc:

Description

As of r61840 file boost/asio/detail/socket_ops.hpp at function gai_serv, there is a call on line 1305 to isdigit which passes serv[0], where serv is declared as a const char*. This causes warning C6328 from the Microsoft code analysis tool PREfast, because isdigit should take an unsigned char, but char is signed if not otherwise specified. Some implementations of ctype.h functions assume that the input is in the range [0, 255], and will misbehave if given a value less than zero. The attached patch requests that the compiler zero-extend the value, which both removes the warning and fixes the problem that the warning is intended to address.

Attachments

foo Download (341 bytes) - added by anonymous 4 years ago.
Patch to boost/asio/detail/socket_ops.hpp to add a static_cast to ensure use of a zero-extending move of serv[0]

Change History

Changed 4 years ago by anonymous

  • attachment foo Download added

Patch to boost/asio/detail/socket_ops.hpp to add a static_cast to ensure use of a zero-extending move of serv[0]

comment:1 Changed 4 years ago by chris_kohlhoff

(In [62556]) Ensure unsigned char is used with isdigit. Refs #4201.

comment:2 Changed 4 years ago by chris_kohlhoff

  • Status changed from new to closed
  • Resolution set to fixed

(In [62644]) Merge from trunk.

........

r62497 | chris_kohlhoff | 2010-06-07 09:28:58 +1000 (Mon, 07 Jun 2010) | 2 lines

Fix handling of small but non-zero timeouts. Fixes #4205.

........

r62499 | chris_kohlhoff | 2010-06-07 10:00:45 +1000 (Mon, 07 Jun 2010) | 2 lines

Reworked implementation MkII. Also fixes #4170.

........

r62530 | chris_kohlhoff | 2010-06-08 09:24:28 +1000 (Tue, 08 Jun 2010) | 2 lines

Fixes for MSVC 7.1, Borland.

........

r62531 | chris_kohlhoff | 2010-06-08 09:29:05 +1000 (Tue, 08 Jun 2010) | 2 lines

Some changes for Symbian support.

........

r62549 | chris_kohlhoff | 2010-06-08 14:27:26 +1000 (Tue, 08 Jun 2010) | 2 lines

Fix typo in tutorial. Fixes #4252.

........

r62556 | chris_kohlhoff | 2010-06-08 19:01:39 +1000 (Tue, 08 Jun 2010) | 2 lines

Ensure unsigned char is used with isdigit. Fixes #4201.

........

r62558 | chris_kohlhoff | 2010-06-08 21:01:57 +1000 (Tue, 08 Jun 2010) | 2 lines

Fix handling of empty buffer sequences.

........

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.