[前][次][番号順一覧][スレッド一覧]

ruby-changes:45118

From: nobu <ko1@a...>
Date: Mon, 26 Dec 2016 18:28:55 +0900 (JST)
Subject: [ruby-changes:45118] nobu:r57191 (trunk): get rid of sprintf

nobu	2016-12-26 18:28:48 +0900 (Mon, 26 Dec 2016)

  New Revision: 57191

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57191

  Log:
    get rid of sprintf
    
    * missing/strerror.c (strerror): use snprintf instead of sprintf.

  Modified files:
    trunk/missing/strerror.c
Index: missing/strerror.c
===================================================================
--- missing/strerror.c	(revision 57190)
+++ missing/strerror.c	(revision 57191)
@@ -13,6 +13,6 @@ strerror(int error) https://github.com/ruby/ruby/blob/trunk/missing/strerror.c#L13
     if (error <= sys_nerr && error > 0) {
 	return sys_errlist[error];
     }
-    sprintf(msg, "Unknown error (%d)", error);
+    snprintf(msg, sizeof(msg), "Unknown error (%d)", error);
     return msg;
 }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]