зеркало из https://github.com/github/ruby.git
* string.c (rb_str_crypt): crypt(3) may return NULL.
Latest glibc (2.16?) crypt(3) actually returns NULL. [Bug #7312] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
1c0323adbc
Коммит
dfb44feefe
|
@ -1,3 +1,8 @@
|
||||||
|
Fri Nov 9 12:58:13 2012 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
|
* string.c (rb_str_crypt): crypt(3) may return NULL.
|
||||||
|
Latest glibc (2.16?) crypt(3) actually returns NULL. [Bug #7312]
|
||||||
|
|
||||||
Fri Nov 9 12:07:06 2012 Akinori MUSHA <knu@iDaemons.org>
|
Fri Nov 9 12:07:06 2012 Akinori MUSHA <knu@iDaemons.org>
|
||||||
|
|
||||||
* include/ruby/ruby.h (alloca), eval_intern.h (alloca), gc.c
|
* include/ruby/ruby.h (alloca), eval_intern.h (alloca), gc.c
|
||||||
|
|
7
string.c
7
string.c
|
@ -6909,6 +6909,7 @@ rb_str_crypt(VALUE str, VALUE salt)
|
||||||
extern char *crypt(const char *, const char *);
|
extern char *crypt(const char *, const char *);
|
||||||
VALUE result;
|
VALUE result;
|
||||||
const char *s, *saltp;
|
const char *s, *saltp;
|
||||||
|
char *res;
|
||||||
#ifdef BROKEN_CRYPT
|
#ifdef BROKEN_CRYPT
|
||||||
char salt_8bit_clean[3];
|
char salt_8bit_clean[3];
|
||||||
#endif
|
#endif
|
||||||
|
@ -6928,7 +6929,11 @@ rb_str_crypt(VALUE str, VALUE salt)
|
||||||
saltp = salt_8bit_clean;
|
saltp = salt_8bit_clean;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
result = rb_str_new2(crypt(s, saltp));
|
res = crypt(s, saltp);
|
||||||
|
if (!res) {
|
||||||
|
rb_sys_fail("crypt");
|
||||||
|
}
|
||||||
|
result = rb_str_new2(res);
|
||||||
OBJ_INFECT(result, str);
|
OBJ_INFECT(result, str);
|
||||||
OBJ_INFECT(result, salt);
|
OBJ_INFECT(result, salt);
|
||||||
return result;
|
return result;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче