Coverity fixes: src/node.cc

This commit is contained in:
Peter Griess authored and Ryan Dahl committed 2010-07-12 13:20:26 -07:00
1 parent c8dba94ff6
commit 4e3c5d88b3
2 files changed
+16 -10

No files matched your search

+2 -2
View File
@@ -1142,7 +1142,7 @@ static Handle<Value> GetAddrInfo(const Arguments& args) {
Local<Function> cb = Local<Function>::Cast(args[2]);
struct resolve_request *rreq = (struct resolve_request *)
calloc(1, sizeof(struct resolve_request) + hostname.length());
calloc(1, sizeof(struct resolve_request) + hostname.length() + 1);
if (!rreq) {
V8::LowMemoryNotification();
@@ -1150,7 +1150,7 @@ static Handle<Value> GetAddrInfo(const Arguments& args) {
String::New("Could not allocate enough memory")));
}
strcpy(rreq->hostname, *hostname);
strncpy(rreq->hostname, *hostname, hostname.length() + 1);
rreq->cb = Persistent<Function>::New(cb);
rreq->ai_family = fam;