(/home/sate/Testcases/c/cve/wireshark-1.2.0/capture_sync.c) |
| |
| 1097 | | | pipe_read_block(int pipe, char *indicator, int len, char *msg) { |
| 1098 | | | int required; |
| 1099 | | | int newly; |
| 1100 | | | guchar [4]; |
| 1101 | | | |
| 1102 | | | |
| 1103 | | | |
| 1104 | | | newly = pipe_read_bytes(pipe, , 4); |
| 1105 | | | if(newly != 4) { |
| 1106 | | | g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, |
| 1107 | | | "read %d failed to read : %u", pipe, newly); |
| 1108 | | | return -1; |
| 1109 | | | } |
| 1110 | | | |
| 1111 | | | |
| 1112 | | | (, 4, indicator, &required); |
| 1113 | | | |
| 1114 | | | |
| 1115 | | | if(required == 0) { |
| 1116 | | | g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, |
| 1117 | | | "read %d indicator: %c empty value", pipe, *indicator); |
| 1118 | | | return 4; |
| 1119 | | | } |
| 1120 | | | |
| 1121 | | | |
| 1122 | | | if(required > len) { |
| 1123 | | | g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, |
| 1124 | | | "read %d length error, required %d > len %d, indicator: %u", |
| 1125 | | | pipe, required, len, *indicator); |
| 1126 | | | |
| 1127 | | | |
| 1128 | | | memcpy(msg, , sizeof()); |
| 1129 | | | newly = read(pipe, &msg[sizeof()], len-sizeof()); |
Ignored Return Value
The return value of read() is never checked in the highlighted execution scenario. - If the return value can indicate an error, the error will be ignored if the highlighted code executes.
- CodeSonar is configured to enforce Ignored Return Value checks for read(). (To change the set of enforced Ignored Return Value checks, use configuration file parameters RETURN_CHECKER_CHECKED_FUNCS and RETURN_CHECKER_IGNORED_FUNCS).
Show: All events | Only primary events |
|
| 1130 | | | g_warning("Unknown message from dumpcap, try to show it as a string: %s", msg);
x /usr/include/glib-2.0/glib/gmessages.h |
| |
153 | #define g_warning(...) g_log (G_LOG_DOMAIN, \ |
154 | G_LOG_LEVEL_WARNING, \ |
155 | __VA_ARGS__) |
| |
|
| 1131 | | | return -1; |
| 1132 | | | } |
| 1133 | | | len = required; |
| 1134 | | | |
| 1135 | | | |
| 1136 | | | newly = pipe_read_bytes(pipe, msg, required); |
| 1137 | | | if(newly != required) { |
| 1138 | | | g_warning("Unknown message from dumpcap, try to show it as a string: %s", msg);
x /usr/include/glib-2.0/glib/gmessages.h |
| |
153 | #define g_warning(...) g_log (G_LOG_DOMAIN, \ |
154 | G_LOG_LEVEL_WARNING, \ |
155 | __VA_ARGS__) |
| |
|
| 1139 | | | return -1; |
| 1140 | | | } |
| 1141 | | | |
| 1142 | | | |
| 1143 | | | g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, |
| 1144 | | | "read %d ok indicator: %c len: %u msg: %s", pipe, *indicator, |
| 1145 | | | len, msg); |
| 1146 | | | return newly + 4; |
| 1147 | | | } |
| |