Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion concore_default_maxtime.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ function concore_default_maxtime(default)
try
maxfile = fopen(strcat(concore.inpath,'1/concore.maxtime'));
instr = fscanf(maxfile,'%c');
concore.maxtime = eval(instr);
% Safe numeric parsing (replaces unsafe eval)
clean_str = strtrim(instr);
clean_str = regexprep(clean_str, '[\[\]]', '');
concore.maxtime = sscanf(clean_str, '%f');
Comment thread
pradeeban marked this conversation as resolved.
Outdated
fclose(maxfile);
catch exc
concore.maxtime = default;
Expand Down
5 changes: 4 additions & 1 deletion concore_initval.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
function [result] = concore_initval(simtime_val)
global concore;
result = eval(simtime_val);
% Safe numeric parsing (replaces unsafe eval)
clean_str = strtrim(simtime_val);
clean_str = regexprep(clean_str, '[\[\]]', '');
Comment thread
pradeeban marked this conversation as resolved.
result = sscanf(clean_str, '%f').';
concore.simtime = result(1);
result = result(2:length(result));
Comment thread
pradeeban marked this conversation as resolved.
Outdated
end
4 changes: 3 additions & 1 deletion concore_iport.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
if isequal(s(i:i+length(target)-1),target)
for j = i+length(target):length(s)
if isequal(s(j),',')||isequal(s(j),'}')
result = eval(s(i+length(target):j-1));
% Safe numeric parsing (replaces unsafe eval)
port_str = strtrim(s(i+length(target):j-1));
result = sscanf(port_str, '%f');
Comment thread
pradeeban marked this conversation as resolved.
return
end
end
Expand Down
5 changes: 4 additions & 1 deletion concore_read.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@
ins = inistr;
end
concore.s = strcat(concore.s, ins);
result = eval(ins);
% Safe numeric parsing (replaces unsafe eval)
clean_str = strtrim(ins);
clean_str = regexprep(clean_str, '[\[\]]', '');
Comment thread
pradeeban marked this conversation as resolved.
result = sscanf(clean_str, '%f').';
Comment thread
GaneshPatil7517 marked this conversation as resolved.
concore.simtime = max(concore.simtime,result(1));
result = result(2:length(result));
Comment thread
pradeeban marked this conversation as resolved.
Outdated
end
Loading