diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2010-03-01 21:27:59 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2010-03-01 21:27:59 +0000 |
commit | 6349316cd30d37d5e0df14c7aba8ba74854b0721 (patch) | |
tree | 94760203263f22c1403b55e9ce8865cda959c95f /lcdgps.c | |
parent | 07cd7fa607e45616371136f5136cff42c6228d5b (diff) | |
download | gpsd-6349316cd30d37d5e0df14c7aba8ba74854b0721.tar.gz |
Pre-release splint and cppcheck cleanup. All regression tests pass.
Diffstat (limited to 'lcdgps.c')
-rw-r--r-- | lcdgps.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -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 */ |