Commit 3b0b5372 authored by williangaspar's avatar williangaspar

sprintf changed to snprintf

parent 8a3577d5
......@@ -461,6 +461,7 @@ void CodegenLLVM::visit(Call &call)
AllocaInst *system_args = b_.CreateAllocaBPF(printf_struct, "system_args");
b_.CreateMemSet(system_args, b_.getInt8(0), struct_size, 1);
// system_id_ has an offset to avoid be confused with printf
b_.CreateStore(b_.getInt64(system_id_ + asyncactionint(AsyncAction::syscall)), system_args);
for (int i=1; i<call.vargs->size(); i++)
{
......
......@@ -221,29 +221,29 @@ void perf_event_printer(void *cb_cookie, void *data, int size)
system(fmt);
break;
case 1:
sprintf(buffer, fmt, arg_values.at(0));
snprintf(buffer, 255, fmt, arg_values.at(0));
system(buffer);
break;
case 2:
sprintf(buffer, fmt, arg_values.at(0), arg_values.at(1));
snprintf(buffer, 255, fmt, arg_values.at(0), arg_values.at(1));
system(buffer);
break;
case 3:
sprintf(buffer, fmt, arg_values.at(0), arg_values.at(1), arg_values.at(2));
snprintf(buffer, 255, fmt, arg_values.at(0), arg_values.at(1), arg_values.at(2));
system(buffer);
break;
case 4:
sprintf(buffer, fmt, arg_values.at(0), arg_values.at(1), arg_values.at(2),
snprintf(buffer, 255, fmt, arg_values.at(0), arg_values.at(1), arg_values.at(2),
arg_values.at(3));
system(buffer);
break;
case 5:
sprintf(buffer, fmt, arg_values.at(0), arg_values.at(1), arg_values.at(2),
snprintf(buffer, 255, fmt, arg_values.at(0), arg_values.at(1), arg_values.at(2),
arg_values.at(3), arg_values.at(4));
system(buffer);
break;
case 6:
sprintf(buffer, fmt, arg_values.at(0), arg_values.at(1), arg_values.at(2),
snprintf(buffer, 255, fmt, arg_values.at(0), arg_values.at(1), arg_values.at(2),
arg_values.at(3), arg_values.at(4), arg_values.at(5));
system(buffer);
break;
......
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