(/home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/erf.c) |
| |
| 305 | | | static int (FILE_T fh, |
| 306 | | | struct wtap_pkthdr *phdr, |
| 307 | | | union *, |
| 308 | | | *, |
| 309 | | | int *err, |
| 310 | | | gchar **err_info, |
| 311 | | | guint32 *bytes_read, |
| 312 | | | guint32 *packet_size) |
| 313 | | | { |
| 314 | | | guint32 mc_hdr; |
| 315 | | | guint8 erf_exhdr[8]; |
| 316 | | | guint64 erf_exhdr_sw; |
| 317 | | | guint8 type = 0; |
| 318 | | | guint16 eth_hdr; |
| 319 | | | guint32 skiplen=0; |
| 320 | | | int i = 0 , max = sizeof(->erf.ehdr_list)/sizeof(struct erf_ehdr); |
| 321 | | | |
| 322 | | | wtap_file_read_expected_bytes(, sizeof(*), fh, err);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/wtap-int.h |
| |
466 | #define wtap_file_read_expected_bytes(target, num_bytes, fh, err) \ |
467 | G_STMT_START \ |
468 | { \ |
469 | int _bytes_read; \ |
470 | _bytes_read = file_read((target), 1, (num_bytes), (fh)); \ |
471 | if (_bytes_read != (int) (num_bytes)) { \ |
472 | *(err) = file_error((fh)); \ |
473 | if (*(err) == 0 && _bytes_read > 0) { \ |
474 | *(err) = WTAP_ERR_SHORT_READ; \ |
475 | } \ |
476 | return FALSE; \ |
477 | } \ |
478 | } \ |
479 | G_STMT_END |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/file_wrappers.h |
| |
36 | #define file_read(buf, bsize, count, file) gzread((file),(buf),(unsigned)((count)*(bsize))) |
| |
|
Event 1:
gzread is an Undefined Function.
hide
Event 2:
Skipping " if". _bytes_read != (int)sizeof( * ) evaluates to false.
hide
Event 3:
Leaving loop. 0 evaluates to false.
hide
|
|
| 323 | | | if (bytes_read != NULL) { |
Event 4:
Taking true branch. bytes_read != (void *)0 evaluates to true.
hide
|
|
| 324 | | | *bytes_read = sizeof(*); |
| 325 | | | } |
| 326 | | | |
| 327 | | | *packet_size = g_ntohs(->rlen) - (guint32)sizeof(*);
x /usr/include/glib-2.0/glib/gtypes.h |
| |
348 | #define g_ntohs(val) (GUINT16_FROM_BE (val)) |
| |
x /usr/include/glib-2.0/glib/gtypes.h |
| |
318 | #define GUINT16_FROM_BE(val) (GUINT16_TO_BE (val)) |
| |
x /usr/lib/i386-linux-gnu/glib-2.0/include/glibconfig.h |
| |
192 | #define GUINT16_TO_BE(val) (GUINT16_SWAP_LE_BE (val)) |
| |
x /usr/include/glib-2.0/glib/gtypes.h |
| |
228 | # define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_IA32 (val)) |
| |
x /usr/include/glib-2.0/glib/gtypes.h |
| |
175 | # define GUINT16_SWAP_LE_BE_IA32(val) \ |
176 | (__extension__ \ |
177 | ({ register guint16 __v, __x = ((guint16) (val)); \ |
178 | if (__builtin_constant_p (__x)) \ |
179 | __v = GUINT16_SWAP_LE_BE_CONSTANT (__x); \ |
180 | else \ |
181 | __asm__ ("rorw $8, %w0" \ |
182 | : "=r" (__v) \ |
183 | : "0" (__x) \ |
184 | : "cc"); \ |
185 | __v; })) |
| |
x /usr/include/glib-2.0/glib/gtypes.h |
| |
143 | #define GUINT16_SWAP_LE_BE_CONSTANT(val) ((guint16) ( \ |
144 | (guint16) ((guint16) (val) >> 8) | \ |
145 | (guint16) ((guint16) (val) << 8))) |
| |
|
Event 6:
Taking false branch. 0 evaluates to false.
hide
|
|
| 328 | | | |
| 329 | | | if (*packet_size > WTAP_MAX_PACKET_SIZE) { |
Event 7:
Skipping " if". *packet_size > 65535 evaluates to false.
hide
|
|
| 330 | | | |
| 331 | | | |
| 332 | | | |
| 333 | | | |
| 334 | | | *err = WTAP_ERR_BAD_RECORD; |
| 335 | | | *err_info = g_strdup_printf("erf: File has %u-byte packet, bigger than maximum of %u", |
| 336 | | | *packet_size, WTAP_MAX_PACKET_SIZE); |
| 337 | | | return FALSE; |
| 338 | | | } |
| 339 | | | |
| 340 | | | if (phdr != NULL) { |
Event 8:
Skipping " if". phdr != (void *)0 evaluates to false.
hide
|
|
| 341 | | | guint64 ts = pletohll(&->ts);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/wtap-int.h |
| |
394 | #define pletohll(p) ((guint64)*((const guint8 *)(p)+7)<<56| \ |
395 | (guint64)*((const guint8 *)(p)+6)<<48| \ |
396 | (guint64)*((const guint8 *)(p)+5)<<40| \ |
397 | (guint64)*((const guint8 *)(p)+4)<<32| \ |
398 | (guint64)*((const guint8 *)(p)+3)<<24| \ |
399 | (guint64)*((const guint8 *)(p)+2)<<16| \ |
400 | (guint64)*((const guint8 *)(p)+1)<<8| \ |
401 | (guint64)*((const guint8 *)(p)+0)<<0) |
| |
|
| 342 | | | |
| 343 | | | phdr->ts.secs = (long) (ts >> 32); |
| 344 | | | ts = ((ts & 0xffffffff) * 1000 * 1000 * 1000); |
| 345 | | | ts += (ts & 0x80000000) << 1; |
| 346 | | | phdr->ts.nsecs = ((int) (ts >> 32)); |
| 347 | | | if (phdr->ts.nsecs >= 1000000000) { |
| 348 | | | phdr->ts.nsecs -= 1000000000; |
| 349 | | | phdr->ts.secs += 1; |
| 350 | | | } |
| 351 | | | } |
| 352 | | | |
| 353 | | | |
| 354 | | | ->erf.phdr.ts = pletohll(&->ts);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/wtap-int.h |
| |
394 | #define pletohll(p) ((guint64)*((const guint8 *)(p)+7)<<56| \ |
395 | (guint64)*((const guint8 *)(p)+6)<<48| \ |
396 | (guint64)*((const guint8 *)(p)+5)<<40| \ |
397 | (guint64)*((const guint8 *)(p)+4)<<32| \ |
398 | (guint64)*((const guint8 *)(p)+3)<<24| \ |
399 | (guint64)*((const guint8 *)(p)+2)<<16| \ |
400 | (guint64)*((const guint8 *)(p)+1)<<8| \ |
401 | (guint64)*((const guint8 *)(p)+0)<<0) |
| |
|
| 355 | | | ->erf.phdr.type = ->type; |
| 356 | | | ->erf.phdr.flags = ->flags; |
| 357 | | | ->erf.phdr.rlen = g_ntohs(->rlen);
x /usr/include/glib-2.0/glib/gtypes.h |
| |
348 | #define g_ntohs(val) (GUINT16_FROM_BE (val)) |
| |
x /usr/include/glib-2.0/glib/gtypes.h |
| |
318 | #define GUINT16_FROM_BE(val) (GUINT16_TO_BE (val)) |
| |
x /usr/lib/i386-linux-gnu/glib-2.0/include/glibconfig.h |
| |
192 | #define GUINT16_TO_BE(val) (GUINT16_SWAP_LE_BE (val)) |
| |
x /usr/include/glib-2.0/glib/gtypes.h |
| |
228 | # define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_IA32 (val)) |
| |
x /usr/include/glib-2.0/glib/gtypes.h |
| |
175 | # define GUINT16_SWAP_LE_BE_IA32(val) \ |
176 | (__extension__ \ |
177 | ({ register guint16 __v, __x = ((guint16) (val)); \ |
178 | if (__builtin_constant_p (__x)) \ |
179 | __v = GUINT16_SWAP_LE_BE_CONSTANT (__x); \ |
180 | else \ |
181 | __asm__ ("rorw $8, %w0" \ |
182 | : "=r" (__v) \ |
183 | : "0" (__x) \ |
184 | : "cc"); \ |
185 | __v; })) |
| |
x /usr/include/glib-2.0/glib/gtypes.h |
| |
143 | #define GUINT16_SWAP_LE_BE_CONSTANT(val) ((guint16) ( \ |
144 | (guint16) ((guint16) (val) >> 8) | \ |
145 | (guint16) ((guint16) (val) << 8))) |
| |
|
Event 9:
Taking false branch. 0 evaluates to false.
hide
|
|
| 358 | | | ->erf.phdr.lctr = g_ntohs(->lctr);
x /usr/include/glib-2.0/glib/gtypes.h |
| |
348 | #define g_ntohs(val) (GUINT16_FROM_BE (val)) |
| |
x /usr/include/glib-2.0/glib/gtypes.h |
| |
318 | #define GUINT16_FROM_BE(val) (GUINT16_TO_BE (val)) |
| |
x /usr/lib/i386-linux-gnu/glib-2.0/include/glibconfig.h |
| |
192 | #define GUINT16_TO_BE(val) (GUINT16_SWAP_LE_BE (val)) |
| |
x /usr/include/glib-2.0/glib/gtypes.h |
| |
228 | # define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_IA32 (val)) |
| |
x /usr/include/glib-2.0/glib/gtypes.h |
| |
175 | # define GUINT16_SWAP_LE_BE_IA32(val) \ |
176 | (__extension__ \ |
177 | ({ register guint16 __v, __x = ((guint16) (val)); \ |
178 | if (__builtin_constant_p (__x)) \ |
179 | __v = GUINT16_SWAP_LE_BE_CONSTANT (__x); \ |
180 | else \ |
181 | __asm__ ("rorw $8, %w0" \ |
182 | : "=r" (__v) \ |
183 | : "0" (__x) \ |
184 | : "cc"); \ |
185 | __v; })) |
| |
x /usr/include/glib-2.0/glib/gtypes.h |
| |
143 | #define GUINT16_SWAP_LE_BE_CONSTANT(val) ((guint16) ( \ |
144 | (guint16) ((guint16) (val) >> 8) | \ |
145 | (guint16) ((guint16) (val) << 8))) |
| |
|
Event 10:
Taking false branch. 0 evaluates to false.
hide
|
|
| 359 | | | ->erf.phdr.wlen = g_ntohs(->wlen);
x /usr/include/glib-2.0/glib/gtypes.h |
| |
348 | #define g_ntohs(val) (GUINT16_FROM_BE (val)) |
| |
x /usr/include/glib-2.0/glib/gtypes.h |
| |
318 | #define GUINT16_FROM_BE(val) (GUINT16_TO_BE (val)) |
| |
x /usr/lib/i386-linux-gnu/glib-2.0/include/glibconfig.h |
| |
192 | #define GUINT16_TO_BE(val) (GUINT16_SWAP_LE_BE (val)) |
| |
x /usr/include/glib-2.0/glib/gtypes.h |
| |
228 | # define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_IA32 (val)) |
| |
x /usr/include/glib-2.0/glib/gtypes.h |
| |
175 | # define GUINT16_SWAP_LE_BE_IA32(val) \ |
176 | (__extension__ \ |
177 | ({ register guint16 __v, __x = ((guint16) (val)); \ |
178 | if (__builtin_constant_p (__x)) \ |
179 | __v = GUINT16_SWAP_LE_BE_CONSTANT (__x); \ |
180 | else \ |
181 | __asm__ ("rorw $8, %w0" \ |
182 | : "=r" (__v) \ |
183 | : "0" (__x) \ |
184 | : "cc"); \ |
185 | __v; })) |
| |
x /usr/include/glib-2.0/glib/gtypes.h |
| |
143 | #define GUINT16_SWAP_LE_BE_CONSTANT(val) ((guint16) ( \ |
144 | (guint16) ((guint16) (val) >> 8) | \ |
145 | (guint16) ((guint16) (val) << 8))) |
| |
|
Event 11:
Taking false branch. 0 evaluates to false.
hide
|
|
| 360 | | | |
| 361 | | | |
| 362 | | | type = ->type; |
| 363 | | | while (type & 0x80){ |
Event 12:
Leaving loop. type & 128 evaluates to false.
hide
|
|
| 364 | | | wtap_file_read_expected_bytes(&erf_exhdr, sizeof(erf_exhdr), fh, err);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/wtap-int.h |
| |
466 | #define wtap_file_read_expected_bytes(target, num_bytes, fh, err) \ |
467 | G_STMT_START \ |
468 | { \ |
469 | int _bytes_read; \ |
470 | _bytes_read = file_read((target), 1, (num_bytes), (fh)); \ |
471 | if (_bytes_read != (int) (num_bytes)) { \ |
472 | *(err) = file_error((fh)); \ |
473 | if (*(err) == 0 && _bytes_read > 0) { \ |
474 | *(err) = WTAP_ERR_SHORT_READ; \ |
475 | } \ |
476 | return FALSE; \ |
477 | } \ |
478 | } \ |
479 | G_STMT_END |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/file_wrappers.h |
| |
36 | #define file_read(buf, bsize, count, file) gzread((file),(buf),(unsigned)((count)*(bsize))) |
| |
|
| 365 | | | if (bytes_read != NULL) |
| 366 | | | *bytes_read += (guint32)sizeof(erf_exhdr); |
| 367 | | | *packet_size -= (guint32)sizeof(erf_exhdr); |
| 368 | | | skiplen += (guint32)sizeof(erf_exhdr); |
| 369 | | | erf_exhdr_sw = pntohll((guint64*) &(erf_exhdr[0]));
x /home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/wtap-int.h |
| |
361 | #define pntohll(p) ((guint64)*((const guint8 *)(p)+0)<<56| \ |
362 | (guint64)*((const guint8 *)(p)+1)<<48| \ |
363 | (guint64)*((const guint8 *)(p)+2)<<40| \ |
364 | (guint64)*((const guint8 *)(p)+3)<<32| \ |
365 | (guint64)*((const guint8 *)(p)+4)<<24| \ |
366 | (guint64)*((const guint8 *)(p)+5)<<16| \ |
367 | (guint64)*((const guint8 *)(p)+6)<<8| \ |
368 | (guint64)*((const guint8 *)(p)+7)<<0) |
| |
|
| 370 | | | if (i < max) |
| 371 | | | memcpy(&->erf.ehdr_list[i].ehdr, &erf_exhdr_sw, sizeof(erf_exhdr_sw)); |
| 372 | | | type = erf_exhdr[0]; |
| 373 | | | i++; |
| 374 | | | } |
| 375 | | | |
| 376 | | | switch (->type & 0x7F) { |
Event 13:
->type & 127 evaluates to 16.
hide
|
|
| 377 | | | case ERF_TYPE_IPV4: |
| 378 | | | case ERF_TYPE_IPV6: |
| 379 | | | case ERF_TYPE_RAW_LINK: |
| 380 | | | case ERF_TYPE_INFINIBAND: |
| 381 | | | |
| 382 | | | |
| 383 | | | |
| 384 | | | |
| 385 | | | |
| 386 | | | |
| 387 | | | |
| 388 | | | break; |
| 389 | | | case ERF_TYPE_PAD: |
| 390 | | | case ERF_TYPE_HDLC_POS: |
| 391 | | | case ERF_TYPE_COLOR_HDLC_POS: |
| 392 | | | case ERF_TYPE_DSM_COLOR_HDLC_POS: |
| 393 | | | case ERF_TYPE_ATM: |
| 394 | | | case ERF_TYPE_AAL5: |
| 395 | | | case ERF_TYPE_AAL2: |
| 396 | | | break; |
| 397 | | | |
| 398 | | | case ERF_TYPE_ETH: |
| 399 | | | case ERF_TYPE_COLOR_ETH: |
| 400 | | | case ERF_TYPE_DSM_COLOR_ETH: |
| 401 | | | wtap_file_read_expected_bytes(ð_hdr, sizeof(eth_hdr), fh, err);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/wtap-int.h |
| |
466 | #define wtap_file_read_expected_bytes(target, num_bytes, fh, err) \ |
467 | G_STMT_START \ |
468 | { \ |
469 | int _bytes_read; \ |
470 | _bytes_read = file_read((target), 1, (num_bytes), (fh)); \ |
471 | if (_bytes_read != (int) (num_bytes)) { \ |
472 | *(err) = file_error((fh)); \ |
473 | if (*(err) == 0 && _bytes_read > 0) { \ |
474 | *(err) = WTAP_ERR_SHORT_READ; \ |
475 | } \ |
476 | return FALSE; \ |
477 | } \ |
478 | } \ |
479 | G_STMT_END |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/file_wrappers.h |
| |
36 | #define file_read(buf, bsize, count, file) gzread((file),(buf),(unsigned)((count)*(bsize))) |
| |
|
Event 14:
gzread is an Undefined Function.
hide
Event 15:
Skipping " if". _bytes_read != (int)sizeof( eth_hdr ) evaluates to false.
hide
Event 16:
Leaving loop. 0 evaluates to false.
hide
|
|
| 402 | | | if (bytes_read != NULL) |
Null Test After Dereference
This code tests the nullness of bytes_read, which has already been dereferenced. - If bytes_read were null, there would have been a prior null pointer dereference at erf.c:324, and potentially at other locations as well.
- Either this test is redundant, or the earlier dereference(s) should be guarded by a similar test.
The issue can occur if the highlighted code executes. See related event 5. Show: All events | Only primary events |
|
| 403 | | | *bytes_read += (guint32)sizeof(eth_hdr); |
| 404 | | | *packet_size -= (guint32)sizeof(eth_hdr); |
| 405 | | | skiplen += (guint32)sizeof(eth_hdr); |
| 406 | | | ->erf.subhdr.eth_hdr = g_htons(eth_hdr);
x /usr/include/glib-2.0/glib/gtypes.h |
| |
350 | #define g_htons(val) (GUINT16_TO_BE (val)) |
| |
x /usr/lib/i386-linux-gnu/glib-2.0/include/glibconfig.h |
| |
192 | #define GUINT16_TO_BE(val) (GUINT16_SWAP_LE_BE (val)) |
| |
x /usr/include/glib-2.0/glib/gtypes.h |
| |
228 | # define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_IA32 (val)) |
| |
x /usr/include/glib-2.0/glib/gtypes.h |
| |
175 | # define GUINT16_SWAP_LE_BE_IA32(val) \ |
176 | (__extension__ \ |
177 | ({ register guint16 __v, __x = ((guint16) (val)); \ |
178 | if (__builtin_constant_p (__x)) \ |
179 | __v = GUINT16_SWAP_LE_BE_CONSTANT (__x); \ |
180 | else \ |
181 | __asm__ ("rorw $8, %w0" \ |
182 | : "=r" (__v) \ |
183 | : "0" (__x) \ |
184 | : "cc"); \ |
185 | __v; })) |
| |
x /usr/include/glib-2.0/glib/gtypes.h |
| |
143 | #define GUINT16_SWAP_LE_BE_CONSTANT(val) ((guint16) ( \ |
144 | (guint16) ((guint16) (val) >> 8) | \ |
145 | (guint16) ((guint16) (val) << 8))) |
| |
|
| 407 | | | break; |
| 408 | | | |
| 409 | | | case ERF_TYPE_MC_HDLC: |
| 410 | | | case ERF_TYPE_MC_RAW: |
| 411 | | | case ERF_TYPE_MC_ATM: |
| 412 | | | case ERF_TYPE_MC_RAW_CHANNEL: |
| 413 | | | case ERF_TYPE_MC_AAL5: |
| 414 | | | case ERF_TYPE_MC_AAL2: |
| 415 | | | case ERF_TYPE_COLOR_MC_HDLC_POS: |
| 416 | | | wtap_file_read_expected_bytes(&mc_hdr, sizeof(mc_hdr), fh, err);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/wtap-int.h |
| |
466 | #define wtap_file_read_expected_bytes(target, num_bytes, fh, err) \ |
467 | G_STMT_START \ |
468 | { \ |
469 | int _bytes_read; \ |
470 | _bytes_read = file_read((target), 1, (num_bytes), (fh)); \ |
471 | if (_bytes_read != (int) (num_bytes)) { \ |
472 | *(err) = file_error((fh)); \ |
473 | if (*(err) == 0 && _bytes_read > 0) { \ |
474 | *(err) = WTAP_ERR_SHORT_READ; \ |
475 | } \ |
476 | return FALSE; \ |
477 | } \ |
478 | } \ |
479 | G_STMT_END |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/file_wrappers.h |
| |
36 | #define file_read(buf, bsize, count, file) gzread((file),(buf),(unsigned)((count)*(bsize))) |
| |
|
| 417 | | | if (bytes_read != NULL) |
| 418 | | | *bytes_read += (guint32)sizeof(mc_hdr); |
| 419 | | | *packet_size -= (guint32)sizeof(mc_hdr); |
| 420 | | | skiplen += (guint32)sizeof(mc_hdr); |
| 421 | | | ->erf.subhdr.mc_hdr = g_htonl(mc_hdr);
x /usr/include/glib-2.0/glib/gtypes.h |
| |
349 | #define g_htonl(val) (GUINT32_TO_BE (val)) |
| |
x /usr/lib/i386-linux-gnu/glib-2.0/include/glibconfig.h |
| |
196 | #define GUINT32_TO_BE(val) (GUINT32_SWAP_LE_BE (val)) |
| |
x /usr/include/glib-2.0/glib/gtypes.h |
| |
229 | # define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_IA32 (val)) |
| |
x /usr/include/glib-2.0/glib/gtypes.h |
| |
203 | # define GUINT32_SWAP_LE_BE_IA32(val) \ |
204 | (__extension__ \ |
205 | ({ register guint32 __v, __x = ((guint32) (val)); \ |
206 | if (__builtin_constant_p (__x)) \ |
207 | __v = GUINT32_SWAP_LE_BE_CONSTANT (__x); \ |
208 | else \ |
209 | __asm__ ("bswap %0" \ |
210 | : "=r" (__v) \ |
211 | : "0" (__x)); \ |
212 | __v; })) |
| |
x /usr/include/glib-2.0/glib/gtypes.h |
| |
147 | #define GUINT32_SWAP_LE_BE_CONSTANT(val) ((guint32) ( \ |
148 | (((guint32) (val) & (guint32) 0x000000ffU) << 24) | \ |
149 | (((guint32) (val) & (guint32) 0x0000ff00U) << 8) | \ |
150 | (((guint32) (val) & (guint32) 0x00ff0000U) >> 8) | \ |
151 | (((guint32) (val) & (guint32) 0xff000000U) >> 24))) |
| |
|
| 422 | | | break; |
| 423 | | | |
| 424 | | | case ERF_TYPE_IP_COUNTER: |
| 425 | | | case ERF_TYPE_TCP_FLOW_COUNTER: |
| 426 | | | |
| 427 | | | default: |
| 428 | | | *err = WTAP_ERR_UNSUPPORTED_ENCAP; |
| 429 | | | *err_info = g_strdup_printf("erf: unknown record encapsulation %u", |
| 430 | | | ->type); |
| 431 | | | return FALSE; |
| 432 | | | } |
| 433 | | | |
| 434 | | | if (phdr != NULL) { |
| 435 | | | phdr->len = g_htons(->wlen);
x /usr/include/glib-2.0/glib/gtypes.h |
| |
350 | #define g_htons(val) (GUINT16_TO_BE (val)) |
| |
x /usr/lib/i386-linux-gnu/glib-2.0/include/glibconfig.h |
| |
192 | #define GUINT16_TO_BE(val) (GUINT16_SWAP_LE_BE (val)) |
| |
x /usr/include/glib-2.0/glib/gtypes.h |
| |
228 | # define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_IA32 (val)) |
| |
x /usr/include/glib-2.0/glib/gtypes.h |
| |
175 | # define GUINT16_SWAP_LE_BE_IA32(val) \ |
176 | (__extension__ \ |
177 | ({ register guint16 __v, __x = ((guint16) (val)); \ |
178 | if (__builtin_constant_p (__x)) \ |
179 | __v = GUINT16_SWAP_LE_BE_CONSTANT (__x); \ |
180 | else \ |
181 | __asm__ ("rorw $8, %w0" \ |
182 | : "=r" (__v) \ |
183 | : "0" (__x) \ |
184 | : "cc"); \ |
185 | __v; })) |
| |
x /usr/include/glib-2.0/glib/gtypes.h |
| |
143 | #define GUINT16_SWAP_LE_BE_CONSTANT(val) ((guint16) ( \ |
144 | (guint16) ((guint16) (val) >> 8) | \ |
145 | (guint16) ((guint16) (val) << 8))) |
| |
|
| 436 | | | phdr->caplen = min( g_htons(->wlen),
x /usr/include/glib-2.0/glib/gtypes.h |
| |
350 | #define g_htons(val) (GUINT16_TO_BE (val)) |
| |
x /usr/lib/i386-linux-gnu/glib-2.0/include/glibconfig.h |
| |
192 | #define GUINT16_TO_BE(val) (GUINT16_SWAP_LE_BE (val)) |
| |
x /usr/include/glib-2.0/glib/gtypes.h |
| |
228 | # define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_IA32 (val)) |
| |
x /usr/include/glib-2.0/glib/gtypes.h |
| |
175 | # define GUINT16_SWAP_LE_BE_IA32(val) \ |
176 | (__extension__ \ |
177 | ({ register guint16 __v, __x = ((guint16) (val)); \ |
178 | if (__builtin_constant_p (__x)) \ |
179 | __v = GUINT16_SWAP_LE_BE_CONSTANT (__x); \ |
180 | else \ |
181 | __asm__ ("rorw $8, %w0" \ |
182 | : "=r" (__v) \ |
183 | : "0" (__x) \ |
184 | : "cc"); \ |
185 | __v; })) |
| |
x /usr/include/glib-2.0/glib/gtypes.h |
| |
143 | #define GUINT16_SWAP_LE_BE_CONSTANT(val) ((guint16) ( \ |
144 | (guint16) ((guint16) (val) >> 8) | \ |
145 | (guint16) ((guint16) (val) << 8))) |
| |
|
| 437 | | | g_htons(->rlen) - (guint32)sizeof(*) - skiplen );
x /usr/include/glib-2.0/glib/gtypes.h |
| |
350 | #define g_htons(val) (GUINT16_TO_BE (val)) |
| |
|
| 438 | | | } |
| 439 | | | return TRUE; |
| 440 | | | } |
| |