Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

* dln_find.c (dln_find_1): use rb_warning and return immediately

  if fname is longer than buffer.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30660 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
commit d6eb807878922b2976831236c3f6235ccfb6edb4 1 parent c8e5ba0
@nobu nobu authored
Showing with 23 additions and 7 deletions.
  1. +5 −0 ChangeLog
  2. +16 −5 dln_find.c
  3. +2 −2 version.h
View
5 ChangeLog
@@ -1,3 +1,8 @@
+Thu Jan 27 08:22:49 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * dln_find.c (dln_find_1): use rb_warning and return immediately
+ if fname is longer than buffer.
+
Wed Jan 26 22:57:30 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
* class.c (clone_method): add GC guard to prevent intermediate
View
21 dln_find.c
@@ -15,10 +15,14 @@
#define dln_memerror rb_memerror
#define dln_exit rb_exit
#define dln_loaderror rb_loaderror
+#define dln_warning rb_warning
+#define dln_warning_arg
#else
#define dln_notimplement --->>> dln not implemented <<<---
#define dln_memerror abort
#define dln_exit exit
+#define dln_warning fprintf
+#define dln_warning_arg stderr,
static void dln_loaderror(const char *format, ...);
#endif
#include "dln.h"
@@ -141,16 +145,23 @@ dln_find_1(const char *fname, const char *path, char *fbuf, size_t size,
static const char pathname_too_long[] = "openpath: pathname too long (ignored)\n\
\tDirectory \"%.*s\"%s\n\tFile \"%.*s\"%s\n";
-#define PATHNAME_TOO_LONG() fprintf(stderr, pathname_too_long, \
- ((bp - fbuf) > 100 ? 100 : (int)(bp - fbuf)), fbuf, \
- ((bp - fbuf) > 100 ? "..." : ""), \
- (fnlen > 100 ? 100 : (int)fnlen), fname, \
- (fnlen > 100 ? "..." : ""))
+#define PATHNAME_TOO_LONG() dln_warning(dln_warning_arg pathname_too_long, \
+ ((bp - fbuf) > 100 ? 100 : (int)(bp - fbuf)), fbuf, \
+ ((bp - fbuf) > 100 ? "..." : ""), \
+ (fnlen > 100 ? 100 : (int)fnlen), fname, \
+ (fnlen > 100 ? "..." : ""))
#define RETURN_IF(expr) if (expr) return (char *)fname;
RETURN_IF(!fname);
fnlen = strlen(fname);
+ if (fnlen >= size) {
+ dln_warning(dln_warning_arg
+ "openpath: pathname too long (ignored)\n\tFile \"%.*s\"%s\n",
+ (fnlen > 100 ? 100 : (int)fnlen), fname,
+ (fnlen > 100 ? "..." : ""));
+ return NULL;
+ }
#ifdef DOSISH
# ifndef CharNext
# define CharNext(p) ((p)+1)
View
4 version.h
@@ -1,11 +1,11 @@
#define RUBY_VERSION "1.9.3"
-#define RUBY_RELEASE_DATE "2011-01-26"
+#define RUBY_RELEASE_DATE "2011-01-27"
#define RUBY_PATCHLEVEL -1
#define RUBY_BRANCH_NAME "trunk"
#define RUBY_RELEASE_YEAR 2011
#define RUBY_RELEASE_MONTH 1
-#define RUBY_RELEASE_DAY 26
+#define RUBY_RELEASE_DAY 27
#include "ruby/version.h"
Please sign in to comment.
Something went wrong with that request. Please try again.