summaryrefslogtreecommitdiff
path: root/gps2udp.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2013-12-06 23:57:15 -0500
committerEric S. Raymond <esr@thyrsus.com>2013-12-06 23:57:15 -0500
commit36672f07cfe438e2e87bedf0cf45fdf2f5431a84 (patch)
tree8e0b536bcbe1ddaa08d8dece5168180c5c90ac8e /gps2udp.c
parentced25abccbb7ecf31d4b1d9c00ea660b3c3bcbc1 (diff)
downloadgpsd-36672f07cfe438e2e87bedf0cf45fdf2f5431a84.tar.gz
Prevent potential overrun errors found by Coverity scanning.
Diffstat (limited to 'gps2udp.c')
-rw-r--r--gps2udp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gps2udp.c b/gps2udp.c
index 3bdd62a7..ac816bc8 100644
--- a/gps2udp.c
+++ b/gps2udp.c
@@ -88,7 +88,7 @@ static int send_udp (char *nmeastring, size_t ind)
if (ind == 0) {
/* compute message size and add 0x0a 0x0d */
for (ind=0; nmeastring [ind] != '\0'; ind ++) {
- if (ind > sizeof(message)) {
+ if (ind >= sizeof(message)) {
fprintf(stderr, "gps2udp: too big [%s] \n", nmeastring);
return -1;
}
@@ -389,7 +389,7 @@ int main(int argc, char **argv)
daemonize = true;
break;
case 'u':
- if (udpchannel > MAX_UDP_DEST) {
+ if (udpchannel >= MAX_UDP_DEST) {
(void)fprintf(stderr,
"gps2udp: too many UDP destinations (max=%d)\n",
MAX_UDP_DEST);