summaryrefslogtreecommitdiff
path: root/lcdgps.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2010-03-01 21:27:59 +0000
committerEric S. Raymond <esr@thyrsus.com>2010-03-01 21:27:59 +0000
commit6349316cd30d37d5e0df14c7aba8ba74854b0721 (patch)
tree94760203263f22c1403b55e9ce8865cda959c95f /lcdgps.c
parent07cd7fa607e45616371136f5136cff42c6228d5b (diff)
downloadgpsd-6349316cd30d37d5e0df14c7aba8ba74854b0721.tar.gz
Pre-release splint and cppcheck cleanup. All regression tests pass.
Diffstat (limited to 'lcdgps.c')
-rw-r--r--lcdgps.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lcdgps.c b/lcdgps.c
index 02bceeac..429e1f99 100644
--- a/lcdgps.c
+++ b/lcdgps.c
@@ -230,14 +230,16 @@ int send_lcd(char *buf) {
int res;
char rcvbuf[256];
+ size_t outlen;
/* Limit the size of outgoing strings. */
- if(strlen(buf)>255) {
- buf[255]=0;
+ outlen = strlen(buf);
+ if(outlen > 255) {
+ outlen = 256;
}
/* send the command */
- res=sockwriteline(sd,buf,strlen(buf));
+ res=sockwriteline(sd,buf,outlen);
/* TODO: check return status */