Skip to content

Commit

Permalink
use snprintf to guard against overflows in exception messages
Browse files Browse the repository at this point in the history
  • Loading branch information
ekarak committed Jun 12, 2019
1 parent a99d9b9 commit 88c1e28
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/utils.hpp
Expand Up @@ -25,8 +25,8 @@
try { \
OpenZWave::Manager::Get() -> METHOD ( __VA_ARGS__ ); \
} catch ( OpenZWave::OZWException& e ) { \
char buffer [100]; \
sprintf(buffer, "Exception calling OpenZWave::Manager::%s in %s(%d): %s", \
char buffer [200]; \
snprintf(buffer, 200, "Exception calling OpenZWave::Manager::%s in %s(%d): %s", \
stringify(METHOD), e.GetFile().c_str(), e.GetLine(), e.GetMsg().c_str()); \
Nan::ThrowError( buffer ); \
}
Expand All @@ -35,8 +35,8 @@
try { \
VALUE = OpenZWave::Manager::Get() -> METHOD ( __VA_ARGS__ ); \
} catch ( OpenZWave::OZWException& e ) { \
char buffer [100]; \
sprintf(buffer, "Exception calling OpenZWave::Manager::%s in %s(%d): %s", \
char buffer [200]; \
snprintf(buffer, 200, "Exception calling OpenZWave::Manager::%s in %s(%d): %s", \
stringify(METHOD), e.GetFile().c_str(), e.GetLine(), e.GetMsg().c_str()); \
Nan::ThrowError( buffer ); \
}
Expand Down

0 comments on commit 88c1e28

Please sign in to comment.