[rtems commit] monitor/mon-prmisc.c: Use puts() not fprintf()

Joel Sherril joel at rtems.org
Wed Nov 26 13:55:51 UTC 2014


Module:    rtems
Branch:    master
Commit:    d4ec0a2d75dc9fd1506fe5e38b20e55ba17a1819
Changeset: http://git.rtems.org/rtems/commit/?id=d4ec0a2d75dc9fd1506fe5e38b20e55ba17a1819

Author:    Josh Oguin <josh.oguin at oarcorp.com>
Date:      Wed Nov 19 14:50:45 2014 -0600

monitor/mon-prmisc.c: Use puts() not fprintf()

CodeSonar flagged this as a case where the user could inject a format
string and cause issues. Since we were not printing anything but a
string, just switching to puts() rather than fprintf(stdout,...) was
sufficient to make this code safer.

---

 cpukit/libmisc/monitor/mon-prmisc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cpukit/libmisc/monitor/mon-prmisc.c b/cpukit/libmisc/monitor/mon-prmisc.c
index b22ae55..8607974 100644
--- a/cpukit/libmisc/monitor/mon-prmisc.c
+++ b/cpukit/libmisc/monitor/mon-prmisc.c
@@ -103,7 +103,7 @@ rtems_monitor_dump_name(rtems_id id)
 
     rtems_object_get_name( id, sizeof(name_buffer), name_buffer );
 
-    return fprintf( stdout, name_buffer );
+    return puts( name_buffer );
 }
 
 int



More information about the vc mailing list