mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2026-03-17 05:34:23 -04:00
connection: Use static strings instead of sprintf and buffer overflow
Spotted by Samuel Rødal <samuel.rodal@nokia.com>
This commit is contained in:
parent
f9b3c15145
commit
64732b01e4
1 changed files with 1 additions and 5 deletions
|
|
@ -692,20 +692,16 @@ void
|
||||||
wl_closure_print(struct wl_closure *closure, struct wl_object *target, int send)
|
wl_closure_print(struct wl_closure *closure, struct wl_object *target, int send)
|
||||||
{
|
{
|
||||||
union wl_value *value;
|
union wl_value *value;
|
||||||
char buffer[4] = "\0";
|
|
||||||
int i;
|
int i;
|
||||||
struct timespec tp;
|
struct timespec tp;
|
||||||
unsigned int time;
|
unsigned int time;
|
||||||
|
|
||||||
if (send)
|
|
||||||
sprintf(buffer, " -> ");
|
|
||||||
|
|
||||||
clock_gettime(CLOCK_REALTIME, &tp);
|
clock_gettime(CLOCK_REALTIME, &tp);
|
||||||
time = (tp.tv_sec * 1000000L) + (tp.tv_nsec / 1000);
|
time = (tp.tv_sec * 1000000L) + (tp.tv_nsec / 1000);
|
||||||
|
|
||||||
fprintf(stderr, "[%10.3f] %s%s@%d.%s(",
|
fprintf(stderr, "[%10.3f] %s%s@%d.%s(",
|
||||||
time / 1000.0,
|
time / 1000.0,
|
||||||
buffer,
|
send ? " -> " : "",
|
||||||
target->interface->name, target->id,
|
target->interface->name, target->id,
|
||||||
closure->message->name);
|
closure->message->name);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue