Opened 15 years ago
Closed 15 years ago
#7159 closed defect (fixed)
Giving strerror a negative value is usually a bad idea
Reported by: | Owned by: | Janne Grunau | |
---|---|---|---|
Priority: | trivial | Milestone: | 0.22 |
Component: | MythTV - General | Version: | head |
Severity: | low | Keywords: | |
Cc: | Ticket locked: | no |
Description
strerror() has undefined behavior when given a value that is negative. In the sound code there is an idiom where the error message uses strerror() w/ the return value of the ioctl(). I understand that the ioctl() in this case might return the error. But since that error also has to be negative according to the check of the value, this might cause problems (like segfaults). If this is actually what the author wants, they should flip the sign of the return value before giving it to strerror().
Attachments (1)
Change History (3)
Changed 15 years ago by
Attachment: | libs_libmythtv-negative-returns added |
---|
comment:1 Changed 15 years ago by
Milestone: | unknown → 0.22 |
---|---|
Owner: | changed from Isaac Richards to Janne Grunau |
Status: | new → accepted |
Note: See
TracTickets for help on using
tickets.
Use errno instead of negative return value when using strerror()