Opened 17 years ago
Closed 17 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)
by , 17 years ago
| Attachment: | libs_libmythtv-negative-returns added |
|---|
comment:1 by , 17 years ago
| Milestone: | unknown → 0.22 |
|---|---|
| Owner: | changed from to |
| Status: | new → accepted |
Note:
See TracTickets
for help on using tickets.

Use errno instead of negative return value when using strerror()