forked from Ivasoft/DSView
set strncpy buffer size
This commit is contained in:
@@ -930,7 +930,7 @@ bool ProtocolDock::protocol_sort_callback(const DecoderInfoItem *o1, const Decod
|
||||
assert(false);
|
||||
}
|
||||
char buf[25];
|
||||
strncpy(buf, id, sizeof(buf));
|
||||
strncpy(buf, id, sizeof(buf)-1);
|
||||
char *rd = buf;
|
||||
char *start = NULL;
|
||||
int len = 0;
|
||||
|
||||
@@ -500,7 +500,7 @@ XLOG_API int xlog_set_domain(xlog_writer* wr, const char *domain)
|
||||
wr->_domain[0] = '\0';
|
||||
|
||||
if (domain && *domain){
|
||||
strncpy(wr->_domain, domain, sizeof(wr->_domain));
|
||||
strncpy(wr->_domain, domain, sizeof(wr->_domain) - 1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ SR_PRIV struct sr_dev_inst *sr_dev_inst_new(int mode, int status,
|
||||
}
|
||||
|
||||
if (model && *model){
|
||||
strncpy(sdi->name, model, sizeof(sdi->name));
|
||||
strncpy(sdi->name, model, sizeof(sdi->name)-1);
|
||||
}
|
||||
|
||||
return sdi;
|
||||
|
||||
Reference in New Issue
Block a user