1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-22 04:17:44 +00:00

- Fix insufficient buffer size for reading dual frequency NovaTel OEM4 range data

PR:		140855
Submitted by:	IPS FreeBSD <freebsd@ips.gov.au>
This commit is contained in:
Dmitry Marakasov 2009-11-28 15:14:47 +00:00
parent ca9d7c2375
commit 3325430aee
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=244920
3 changed files with 35 additions and 0 deletions

View File

@ -7,6 +7,7 @@
PORTNAME= gpstk
PORTVERSION= 1.5
PORTREVISION= 1
CATEGORIES= astro devel
MASTER_SITES= SF
DISTNAME= ${PORTNAME}${PORTVERSION}.src

View File

@ -0,0 +1,23 @@
--- lib/rxio/NovatelData.cpp.FCS 2009-11-24 09:08:46.000000000 +1100
+++ lib/rxio/NovatelData.cpp 2009-11-24 09:40:31.000000000 +1100
@@ -304,7 +304,9 @@
cout << "datasize:" << datasize << endl;
// read the rest of the record
- if(datasize-12 >= 1024) {
+ // Note: OEM2 The Message byte count equals the total
+ // length of the data block including the header.
+ if(datasize >= sizeof(buffer)) {
//FFStreamError fe("Read error - buffer overflow");
//GPSTK_THROW(fe);
failure = 1;
@@ -440,7 +442,8 @@
// ---------------------------------------
// read the data message, but don't overwrite the header
// first check against buffer overflow
- if(datasize-28 >= 1024 || datasize-28 < 0) {
+ // OEM4 total buffer usage = header+data
+ if(datasize+28 >= sizeof(buffer)) {
//FFStreamError fe("Read error - buffer overflow");
//GPSTK_THROW(fe);
failure = 1;

View File

@ -0,0 +1,11 @@
--- lib/rxio/NovatelData.hpp.FCS 2009-11-24 09:08:58.000000000 +1100
+++ lib/rxio/NovatelData.hpp 2009-11-24 09:09:34.000000000 +1100
@@ -165,7 +165,7 @@
private:
/// private data members
- unsigned char buffer[1024]; ///< buffer for raw data
+ unsigned char buffer[2048]; ///< buffer for raw data
/// Reference GPS week, for OEM2, where the nav records require a GPS week,
/// but only the obs records have one, and then it is 10-bit.