Commit 2a63478c authored by Bill King's avatar Bill King
Browse files

Coverity security fixes

parent 0732fd03
......@@ -656,8 +656,9 @@ char *ne7ssh::readAndReset(int channel, char *(*alloc)(size_t))
data = connections[i]->getReceived();
if (data.size())
{
buffer = alloc(connections[i]->getReceived().size());
strcpy(buffer, reinterpret_cast<char*>(connections[i]->getReceived().begin()));
Botan::SecureVector<Botan::byte>& received=connections[i]->getReceived();
buffer = alloc(received.size());
strncpy(buffer, reinterpret_cast<char*>(received.begin()), received.size());
connections[i]->resetReceiveBuffer();
}
break;
......
......@@ -69,14 +69,18 @@ bool ne7ssh_string::addFile (const char* filename)
fseek (FI, 0L, SEEK_END);
size = ftell (FI);
rewind (FI);
data = (Botan::byte*) malloc (size);
fread (data, size, 1, FI);
fclose (FI);
buffer.append (data, (u32bit) size);
free (data);
return true;
if(size > 0) {
rewind (FI);
data = (Botan::byte*) malloc (size);
fread (data, size, 1, FI);
fclose (FI);
buffer.append (data, (u32bit) size);
free (data);
return true;
}
fclose(FI);
return false;
}
void ne7ssh_string::addBigInt (const Botan::BigInt& bn)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment