diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-02-28 15:21:13 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-02-28 15:21:13 +0000 |
commit | 30fc6be8600f0920803fa71233957dd7d1e9f058 (patch) | |
tree | 9bb8d3620dca905a0a95d6ce5052e5c70a883d98 /src/transport/gnunet-helper-transport-wlan.c | |
parent | 83bb27bce557535f5c4738584ac05d2a7b797bbe (diff) | |
download | gnunet-30fc6be8600f0920803fa71233957dd7d1e9f058.tar.gz gnunet-30fc6be8600f0920803fa71233957dd7d1e9f058.zip |
-make no assumptions about the value of EINVAL
Diffstat (limited to 'src/transport/gnunet-helper-transport-wlan.c')
-rw-r--r-- | src/transport/gnunet-helper-transport-wlan.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/transport/gnunet-helper-transport-wlan.c b/src/transport/gnunet-helper-transport-wlan.c index 2a6fcb8fb..25b94677f 100644 --- a/src/transport/gnunet-helper-transport-wlan.c +++ b/src/transport/gnunet-helper-transport-wlan.c | |||
@@ -709,7 +709,7 @@ mst_destroy (struct MessageStreamTokenizer *mst) | |||
709 | * @param iterator iterator to initialize | 709 | * @param iterator iterator to initialize |
710 | * @param radiotap_header message to parse | 710 | * @param radiotap_header message to parse |
711 | * @param max_length number of valid bytes in radiotap_header | 711 | * @param max_length number of valid bytes in radiotap_header |
712 | * @return 0 on success | 712 | * @return 0 on success, -1 on error |
713 | */ | 713 | */ |
714 | static int | 714 | static int |
715 | ieee80211_radiotap_iterator_init (struct ieee80211_radiotap_iterator *iterator, | 715 | ieee80211_radiotap_iterator_init (struct ieee80211_radiotap_iterator *iterator, |
@@ -719,16 +719,16 @@ ieee80211_radiotap_iterator_init (struct ieee80211_radiotap_iterator *iterator, | |||
719 | { | 719 | { |
720 | if ( (iterator == NULL) || | 720 | if ( (iterator == NULL) || |
721 | (radiotap_header == NULL) ) | 721 | (radiotap_header == NULL) ) |
722 | return -EINVAL; | 722 | return -1; |
723 | 723 | ||
724 | /* Linux only supports version 0 radiotap format */ | 724 | /* Linux only supports version 0 radiotap format */ |
725 | if (0 != radiotap_header->it_version) | 725 | if (0 != radiotap_header->it_version) |
726 | return -EINVAL; | 726 | return -1; |
727 | 727 | ||
728 | /* sanity check for allowed length and radiotap length field */ | 728 | /* sanity check for allowed length and radiotap length field */ |
729 | if ( (max_length < sizeof (struct ieee80211_radiotap_header)) || | 729 | if ( (max_length < sizeof (struct ieee80211_radiotap_header)) || |
730 | (max_length < (GNUNET_le16toh (radiotap_header->it_len))) ) | 730 | (max_length < (GNUNET_le16toh (radiotap_header->it_len))) ) |
731 | return -EINVAL; | 731 | return -1; |
732 | 732 | ||
733 | iterator->rtheader = radiotap_header; | 733 | iterator->rtheader = radiotap_header; |
734 | iterator->max_length = GNUNET_le16toh (radiotap_header->it_len); | 734 | iterator->max_length = GNUNET_le16toh (radiotap_header->it_len); |
@@ -752,7 +752,7 @@ ieee80211_radiotap_iterator_init (struct ieee80211_radiotap_iterator *iterator, | |||
752 | * stated radiotap header length | 752 | * stated radiotap header length |
753 | */ | 753 | */ |
754 | if (iterator->arg - ((uint8_t*) iterator->rtheader) > iterator->max_length) | 754 | if (iterator->arg - ((uint8_t*) iterator->rtheader) > iterator->max_length) |
755 | return -EINVAL; | 755 | return -1; |
756 | } | 756 | } |
757 | iterator->arg += sizeof (uint32_t); | 757 | iterator->arg += sizeof (uint32_t); |
758 | /* | 758 | /* |
@@ -777,7 +777,7 @@ ieee80211_radiotap_iterator_init (struct ieee80211_radiotap_iterator *iterator, | |||
777 | * | 777 | * |
778 | * @param iterator: radiotap_iterator to move to next arg (if any) | 778 | * @param iterator: radiotap_iterator to move to next arg (if any) |
779 | * | 779 | * |
780 | * @return next present arg index on success or negative if no more or error | 780 | * @return next present arg index on success or -1 if no more or error |
781 | */ | 781 | */ |
782 | static int | 782 | static int |
783 | ieee80211_radiotap_iterator_next (struct ieee80211_radiotap_iterator *iterator) | 783 | ieee80211_radiotap_iterator_next (struct ieee80211_radiotap_iterator *iterator) |
@@ -883,7 +883,7 @@ ieee80211_radiotap_iterator_next (struct ieee80211_radiotap_iterator *iterator) | |||
883 | 883 | ||
884 | if ((((void *) iterator->arg) - ((void *) iterator->rtheader)) > | 884 | if ((((void *) iterator->arg) - ((void *) iterator->rtheader)) > |
885 | iterator->max_length) | 885 | iterator->max_length) |
886 | return -EINVAL; | 886 | return -1; |
887 | 887 | ||
888 | next_entry: | 888 | next_entry: |
889 | 889 | ||
@@ -1162,7 +1162,7 @@ linux_read (struct HardwareInfos *dev, unsigned char *buf, size_t buf_size, | |||
1162 | 1162 | ||
1163 | rthdr = (struct ieee80211_radiotap_header *) tmpbuf; | 1163 | rthdr = (struct ieee80211_radiotap_header *) tmpbuf; |
1164 | 1164 | ||
1165 | if (ieee80211_radiotap_iterator_init (&iterator, rthdr, caplen) < 0) | 1165 | if (0 != ieee80211_radiotap_iterator_init (&iterator, rthdr, caplen)) |
1166 | return 0; | 1166 | return 0; |
1167 | 1167 | ||
1168 | /* go through the radiotap arguments we have been given | 1168 | /* go through the radiotap arguments we have been given |