Comments (1)
Additionally to that I do see a potential buffer overflow issue with this code
while (client.available()) {
...
if (bufferPosition < sizeof(buffer)-1) {
buffer[bufferPosition] = c;
} else if ((bufferPosition == sizeof(buffer)-1)) {
buffer[bufferPosition] = '\0'; // Null-terminate buffer
client.stop();
error = true;
#ifdef LOGGING
Serial.println("HttpClient>\tError: Response body larger than buffer.");
#endif
}
bufferPosition++;
}
buffer[bufferPosition] = '\0'; // Null-terminate buffer
In case of a response greater or equal to sizeof(buffer)
the final bufferPosition++
will increment to sizeof(buffer)
and the following buffer[bufferPosition] = '\0'
will actually end up in the byte following the actual buffer.
There actually should be a break
inside the else if()
branch to avoid the additional increment (and the zero-termination inside that branch can be omitted due to the same instruction following the loop.
from httpclient.
Related Issues (20)
- Possible misinterpretation of empty http_request_t.hostname
- Not receiving the data from Spark core
- Error: Timeout while reading response.
- Compile error using example files HOT 1
- Turning off logging HOT 1
- calling local IPs HOT 2
- passing authorisation credential HOT 3
- 'millis' was not declared in this scope HOT 1
- Update particle.io library HOT 1
- 'atoi' was not declared in this scope HOT 1
- 'delay' was not declared in this scope HOT 5
- 'HTTP_METHOD_GET' was not declared in this scope HOT 3
- TCP connection seems to block until timeout HOT 4
- 'http_request_t' has a previous declaration as 'typedef struct http_request_t http_request_t'
- response codes not working all the time HOT 2
- Example Fails HOT 1
- build in atom into cloud
- Race condition when no data immediately available but client disconnects
- Convert Arduino Strings to C char[] arrays to prevent memory fragmentation.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from httpclient.