diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2013-12-06 23:57:15 -0500 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2013-12-06 23:57:15 -0500 |
commit | 36672f07cfe438e2e87bedf0cf45fdf2f5431a84 (patch) | |
tree | 8e0b536bcbe1ddaa08d8dece5168180c5c90ac8e /gps2udp.c | |
parent | ced25abccbb7ecf31d4b1d9c00ea660b3c3bcbc1 (diff) | |
download | gpsd-36672f07cfe438e2e87bedf0cf45fdf2f5431a84.tar.gz |
Prevent potential overrun errors found by Coverity scanning.
Diffstat (limited to 'gps2udp.c')
-rw-r--r-- | gps2udp.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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); |