Skip to content

Commit

Permalink
fixed potential buffer overflow in broker queue reader
Browse files Browse the repository at this point in the history
  • Loading branch information
faburaya committed Mar 19, 2017
1 parent d180179 commit 2308e05
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions 3FD/broker_impl_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,14 +250,11 @@ namespace broker

m_stoProcExecStmt.reset(new Poco::Data::Statement(dbSession));

char queryStrBuf[128];
sprintf(queryStrBuf,
"exec [%s/v1_0_0/ReadMessagesProc] %d, %d;",
serviceURL.c_str(),
(int)msgCountStepLimit,
(int)msgRecvTimeout);
std::ostringstream oss;
oss << "exec [" << serviceURL << "/v1_0_0/ReadMessagesProc] "
<< msgCountStepLimit << ", " << msgRecvTimeout << ";";

*m_stoProcExecStmt << queryStrBuf, into(m_messages);
*m_stoProcExecStmt << oss.str(), into(m_messages);

dbSession.begin();

Expand Down

0 comments on commit 2308e05

Please sign in to comment.