glibという事で、色んなプログラムの根元にあたるライブラリなのですが、以下の記事のように脆弱性があるようですっ!(ごめんなさい手抜きです・・・)
参考にさせてもらったURL
・脆弱性の内容とチェックプログラム(Linux版)
http://www.linuxmaster.jp/linux_blog/2015/01/linux-gnu-cglibccve-2015-0235.html
・Solarisのgethostbyname_rの関数の引数
http://docs.oracle.com/cd/E23823_01/html/816-5170/endhostent-3nsl.html
そこで、SolarisというOSでもこのghost.c動かないかなぁと試してみたのが以下。
| 
					 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41  | 
						vi ghost.c --- #include <netdb .h> #include <stdio .h> #include <stdlib .h> #include <string .h> #include <errno .h> #define CANARY "in_the_coal_mine" struct {   char buffer[1024];   char canary[sizeof(CANARY)]; } temp = { "buffer", CANARY }; int main(void) {   struct hostent resbuf;   struct hostent *result;   int herrno;   int retval;   size_t len = sizeof(temp.buffer) - 16*sizeof(unsigned char) - 2*sizeof(char *) - 1;   char name[sizeof(temp.buffer)];   memset(name, '0', len);   name[len] = '\0';   retval =(int) gethostbyname_r(name, &result, temp.buffer, sizeof(temp.buffer), &herrno);   if (strcmp(temp.canary, CANARY) != 0) {     puts("vulnerable");     exit(EXIT_SUCCESS);   }   if (retval == ERANGE) {     puts("not vulnerable");     exit(EXIT_SUCCESS);   }   puts("should not happen");   exit(EXIT_FAILURE); } --- </errno></string></stdlib></stdio></netdb>←これWordPressが勝手につけちゃって消せない・・・  | 
					
コンパイルは以下の通り
| 
					 1  | 
						gcc -lnsl -o ghost -O2 -DSOLARIS2=10 -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT -D_LARGEFILE64_SOURCE ghost.c  | 
					
あれ?これglibc使われてるんだろうか・・・-lnslって。調べなおしだわ|ω・`)
