From 1771ee203fd749b21a51439cde853f7134688f30 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Tue, 23 Aug 2005 11:38:27 -0400 Subject: don't use sprintf. It's not guaranteed to not scribble over memory. base/remote_gdb.cc: use snprintf, it's safer dev/ide_disk.cc: use strncpy instead of snprintf --HG-- extra : convert_revision : 90455e3f6bcb4c771724298a5a0b79a5b483a85c --- base/remote_gdb.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'base') diff --git a/base/remote_gdb.cc b/base/remote_gdb.cc index 3685b05d1..17331fcd9 100644 --- a/base/remote_gdb.cc +++ b/base/remote_gdb.cc @@ -834,7 +834,7 @@ RemoteGDB::trap(int type) active = true; else // Tell remote host that an exception has occurred. - sprintf((char *)buffer, "S%02x", signal(type)); + snprintf((char *)buffer, sizeof(buffer), "S%02x", signal(type)); send(buffer); // Stick frame regs into our reg cache. @@ -852,7 +852,7 @@ RemoteGDB::trap(int type) // if this command came from a running gdb, answer it -- // the other guy has no way of knowing if we're in or out // of this loop when he issues a "remote-signal". - sprintf((char *)buffer, "S%02x", signal(type)); + snprintf((char *)buffer, sizeof(buffer), "S%02x", signal(type)); send(buffer); continue; -- cgit v1.2.3