[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freewnn:00361] Re: PATCH: gets_cur & getws_cur size limit (Re: security problem of jserver)



 $B85LZ$G$9!#(B

 $B$F$J$o$1$G!"%Q%C%A$NBh(B2$BCF$G$9!#(B

 $BJR;3$5$s$+$i$N%"%I%P%$%9$K$h$j!"%P%C%U%!%5%$%:$r1[$($?>l9g(B
 $B6uFI$_$9$k$h$&$K=$@5$7$^$7$?!#(B

 $B$^$?!"(Bexpand_file_name () $B$,$3$l$^$?2x$7$$%3!<%I$K$J$C$F$$(B
 $B$?$N$G=$@5$7$^$7$?!#(B
 $B$=$l$K$H$b$J$$!"3F=j$KuBV$G!"(B"ABCDEFGHIJKLMN\0" $B$HAw$i$l$F$-$?(B
 $B$H$7$F!"(B
 
 buffer_size  buffer (^ $B$O(B b $B$N0LCV(B)
 4            A
               ^
 3            AB
                ^
 2            ABC
                 ^
 1            ABCD 
                  ^
 0            ABCD 
                  ^
              ABCD\0

 $B$J$N$GBg>fIW$J$N$G$O$J$$$G$7$g$&$+!)(B

| $B$N$h$&$K!"%P%C%U%!!e$Nu$r8+D>$7$F$_$k$$$$5!2q$G$9$M!#(B

sin.
diff -cNdr FreeWnn-1.1.1-a016.orig/Xsi/Wnn/jserver/de.c FreeWnn-1.1.1-a016/Xsi/Wnn/jserver/de.c
*** FreeWnn-1.1.1-a016.orig/Xsi/Wnn/jserver/de.c	Thu Feb 24 00:31:33 2000
--- FreeWnn-1.1.1-a016/Xsi/Wnn/jserver/de.c	Thu Mar  9 17:50:34 2000
***************
*** 48,53 ****
--- 48,57 ----
  
  #include <sys/ioctl.h>
  
+ #if defined(HAVE_SYS_TYPES_H)
+ #include <sys/types.h>
+ #endif
+ 
  #if (defined(__unix__) || defined(unix)) && !defined(USG)
  #include <sys/param.h>
  #endif
***************
*** 599,617 ****
  /*------*/
  
  /**     **/
! void
! gets_cur (cp)
!      register char *cp;
  {
!   while ((*cp++ = getc_cur ()) != '\0');
  }
  
  /**     **/
! void
! getws_cur (cp)
!      register w_char *cp;
  {
!   while ((*cp++ = get2_cur ()) != 0);
  }
  
  /**     カレント・クライアントから2バイト取る   **/
--- 603,657 ----
  /*------*/
  
  /**     **/
! char *
! gets_cur (buffer, buffer_size)
!      char *buffer;
!      size_t buffer_size;
  {
!   char *b;
! 
!   if (!buffer || !buffer_size)
!     return NULL;
! 
!   b = buffer;
! 
!   while (--buffer_size && (*b = getc_cur ()) != '\0')
!     b++;
! 
!   if (*b != '\0')
!     {
!       *b = '\0';
!       while (getc_cur () != '\0')
! 	;
!     }
! 
!   return buffer;
  }
  
  /**     **/
! w_char *
! getws_cur (buffer, buffer_size)
!      w_char *buffer;
!      size_t buffer_size;
  {
!   w_char *b;
! 
!   if (!buffer || !buffer_size)
!     return NULL;
! 
!   b = buffer;
! 
!   while (--buffer_size && (*b = get2_cur ()) != 0)
!     b++;
!   
!   if (*b != 0)
!     {
!       *b = 0;
!       while (getc_cur () != 0)
! 	;
!     }
! 
!   return buffer;
  }
  
  /**     カレント・クライアントから2バイト取る   **/
diff -cNdr FreeWnn-1.1.1-a016.orig/Xsi/Wnn/jserver/de_header.h FreeWnn-1.1.1-a016/Xsi/Wnn/jserver/de_header.h
*** FreeWnn-1.1.1-a016.orig/Xsi/Wnn/jserver/de_header.h	Thu Feb 24 00:31:35 2000
--- FreeWnn-1.1.1-a016/Xsi/Wnn/jserver/de_header.h	Thu Mar  9 17:25:33 2000
***************
*** 183,188 ****
--- 183,196 ----
  
  extern char lang_dir[];
  
+ #if !defined(__P)
+ #if (defined(__STDC_) && __STDC__) || defined(_cplusplus)
+ #define __P(p) p
+ #else
+ #define __P(p) ()
+ #endif
+ #endif
+ 
  /* atojis.c */
  extern w_char *get_giji_knj ();
  extern void giji_hindoup ();
***************
*** 216,223 ****
  /* de.c */
  extern void del_client ();
  extern void demon_fin ();
! extern void gets_cur ();
! extern void getws_cur ();
  extern int get2_cur ();
  extern int get4_cur ();
  extern int getc_cur ();
--- 224,231 ----
  /* de.c */
  extern void del_client ();
  extern void demon_fin ();
! extern char *gets_cur __P ((char *buffer, size_t buffer_size));
! extern w_char *getws_cur __P ((w_char *buffer, size_t buffer_size));
  extern int get2_cur ();
  extern int get4_cur ();
  extern int getc_cur ();
***************
*** 234,240 ****
  /* dispatch.c */
  extern void do_command ();
  extern void get_file_name ();
! extern void expand_file_name ();
  extern void error_ret ();
  /* do_dic_env.c */
  extern void js_dic_add ();
--- 242,248 ----
  /* dispatch.c */
  extern void do_command ();
  extern void get_file_name ();
! extern void expand_file_name __P ((char *p));
  extern void error_ret ();
  /* do_dic_env.c */
  extern void js_dic_add ();
diff -cNdr FreeWnn-1.1.1-a016.orig/Xsi/Wnn/jserver/dispatch.c FreeWnn-1.1.1-a016/Xsi/Wnn/jserver/dispatch.c
*** FreeWnn-1.1.1-a016.orig/Xsi/Wnn/jserver/dispatch.c	Thu Feb 24 00:31:33 2000
--- FreeWnn-1.1.1-a016/Xsi/Wnn/jserver/dispatch.c	Thu Mar  9 18:56:28 2000
***************
*** 33,48 ****
   *      Command Dispatch routine
   */
  
  #include <stdio.h>
  
  #include "commonhd.h"
  #include "demcom.h"
  #include "de_header.h"
  
  extern int cur_clp;
  
- void expand_file_name ();
- 
  void
  do_command ()
  {
--- 33,52 ----
   *      Command Dispatch routine
   */
  
+ #include <config.h>
+ 
  #include <stdio.h>
  
+ #if defined(HAVE_SYS_TYPES_H)
+ #include "sys/types.h"
+ #endif
+ 
  #include "commonhd.h"
  #include "demcom.h"
  #include "de_header.h"
  
  extern int cur_clp;
  
  void
  do_command ()
  {
***************
*** 236,269 ****
          communication routine
   */
  
! void
! get_file_name (p)
!      register char *p;
  {
!   gets_cur (p);
!   if (p[0] == 0)
!     {
!       return;
!     }
!   expand_file_name (p);
  }
  
! void
! expand_file_name (p)
!      register char *p;
  {
!   char path[FILENAME];
!   register char *q;
!   if (*p != '/')
      {
        strcpy (path, jserver_dir);
  /*      strcat(path,c_c->user_name);   */
        strcat (path, "/");
!       strcat (path, p);
!       strcpy (p, path);
      }
!   for (q = p; *q++;);
    q -= 2;
    for (;;)
      {
        if (*q != '/')
--- 240,291 ----
          communication routine
   */
  
! char *
! get_file_name (buffer, buffer_size)
!      char *buffer;
!      size_t buffer_size;
  {
!   buffer = gets_cur (buffer, buffer_size);
! 
!   if (!buffer || *buffer == '\0')
!     return NULL;
! 
!   return expand_file_name (buffer, buffer_size);
  }
  
! char *
! expand_file_name (buffer, buffer_size)
!      char *buffer;
!      size_t buffer_size;
  {
!   char *q;
! 
!   if (*buffer != '/')
      {
+       char *path;
+       size_t path_len;
+ 
+       path_len = strlen (jserver_dir) + strlen (buffer) + 2;
+       if (path_len > buffer_size)
+ 	return NULL;
+       
+       path = malloc (path_len);
+       if (!path)
+ 	return NULL;
+ 
        strcpy (path, jserver_dir);
  /*      strcat(path,c_c->user_name);   */
        strcat (path, "/");
!       strcat (path, buffer);
!       strcpy (buffer, path);
! 
!       free (path);
      }
! 
!   for (q = buffer; *q++; )
!     ;
    q -= 2;
+ 
    for (;;)
      {
        if (*q != '/')
***************
*** 273,278 ****
--- 295,302 ----
  /*
  fprintf(stderr,"file_name=%s\n",p);
  */
+ 
+   return buffer;
  }
  
  void
diff -cNdr FreeWnn-1.1.1-a016.orig/Xsi/Wnn/jserver/do_dic_env.c FreeWnn-1.1.1-a016/Xsi/Wnn/jserver/do_dic_env.c
*** FreeWnn-1.1.1-a016.orig/Xsi/Wnn/jserver/do_dic_env.c	Thu Feb 24 00:31:33 2000
--- FreeWnn-1.1.1-a016/Xsi/Wnn/jserver/do_dic_env.c	Thu Mar  9 17:25:33 2000
***************
*** 59,66 ****
    nice = get4_cur ();
    rw = get4_cur ();
    hrw = get4_cur ();
!   gets_cur (pw);
!   gets_cur (pw1);
    rev = get4_cur ();            /* rev is to add it as reverse dict */
  
    error1 ("dic_add: eid=%d,fid=%d,hfid=%d", eid, fid, hfid);
--- 59,66 ----
    nice = get4_cur ();
    rw = get4_cur ();
    hrw = get4_cur ();
!   gets_cur (pw, WNN_PASSWD_LEN);
!   gets_cur (pw1, WNN_PASSWD_LEN);
    rev = get4_cur ();            /* rev is to add it as reverse dict */
  
    error1 ("dic_add: eid=%d,fid=%d,hfid=%d", eid, fid, hfid);
diff -cNdr FreeWnn-1.1.1-a016.orig/Xsi/Wnn/jserver/do_dic_no.c FreeWnn-1.1.1-a016/Xsi/Wnn/jserver/do_dic_no.c
*** FreeWnn-1.1.1-a016.orig/Xsi/Wnn/jserver/do_dic_no.c	Thu Feb 24 00:31:34 2000
--- FreeWnn-1.1.1-a016/Xsi/Wnn/jserver/do_dic_no.c	Thu Mar  9 17:25:33 2000
***************
*** 132,140 ****
    w_char yomi[LENGTHYOMI], kanji[LENGTHKANJI], comment[LENGTHKANJI];
    envi = get4_cur ();           /* env_id */
    dic_no = get4_cur ();
!   getws_cur (yomi);
!   getws_cur (kanji);
!   getws_cur (comment);
    hinsi = get4_cur ();
    hindo = get4_cur ();
    ret = word_add (envi, dic_no, yomi, kanji, hinsi, hindo, comment);
--- 132,140 ----
    w_char yomi[LENGTHYOMI], kanji[LENGTHKANJI], comment[LENGTHKANJI];
    envi = get4_cur ();           /* env_id */
    dic_no = get4_cur ();
!   getws_cur (yomi, LENGTHYOMI);
!   getws_cur (kanji, LENGTHKANJI);
!   getws_cur (comment, LENGTHKANJI);
    hinsi = get4_cur ();
    hindo = get4_cur ();
    ret = word_add (envi, dic_no, yomi, kanji, hinsi, hindo, comment);
***************
*** 177,183 ****
    int n;
  
    c_env = env[get4_cur ()];
!   getws_cur (yomi);
  #ifdef  CONVERT_from_TOP
    Strcpy (ryomi, yomi);
  #else
--- 177,183 ----
    int n;
  
    c_env = env[get4_cur ()];
!   getws_cur (yomi, LENGTHYOMI);
  #ifdef  CONVERT_from_TOP
    Strcpy (ryomi, yomi);
  #else
***************
*** 210,216 ****
  
    get4_cur ();                  /* env_id */
    dic_no = get4_cur ();
!   getws_cur (yomi);
  #ifdef  CONVERT_from_TOP
    Strcpy (ryomi, yomi);
  #else
--- 210,216 ----
  
    get4_cur ();                  /* env_id */
    dic_no = get4_cur ();
!   getws_cur (yomi, LENGTHYOMI);
  #ifdef  CONVERT_from_TOP
    Strcpy (ryomi, yomi);
  #else
***************
*** 243,249 ****
    envi = get4_cur ();           /* env_id */
    dic_no = get4_cur ();
    entry = get4_cur ();
!   getws_cur (comment);
  
    ret = word_comment_set (envi, dic_no, entry, comment);
    if (ret == -1)
--- 243,249 ----
    envi = get4_cur ();           /* env_id */
    dic_no = get4_cur ();
    entry = get4_cur ();
!   getws_cur (comment, LENGTHKANJI);
  
    ret = word_comment_set (envi, dic_no, entry, comment);
    if (ret == -1)
***************
*** 401,407 ****
    w_char name[WNN_HINSI_NAME_LEN];
    int no;
  
!   getws_cur (name);
  
    if ((no = wnn_hinsi_number (name)) == -1)
      {
--- 401,407 ----
    w_char name[WNN_HINSI_NAME_LEN];
    int no;
  
!   getws_cur (name, WNN_HINSI_NAME_LEN);
  
    if ((no = wnn_hinsi_number (name)) == -1)
      {
***************
*** 427,433 ****
  
    envi = get4_cur ();
    dic_no = get4_cur ();
!   getws_cur (name);
  
    if (dic_no == -1)
      {
--- 427,433 ----
  
    envi = get4_cur ();
    dic_no = get4_cur ();
!   getws_cur (name, WNN_HINSI_NAME_LEN);
  
    if (dic_no == -1)
      {
***************
*** 564,570 ****
  
    envi = get4_cur ();
    dic_no = get4_cur ();
!   getws_cur (table);
  
  
    if (!dic_in_envp (dic_no, envi))
--- 564,570 ----
  
    envi = get4_cur ();
    dic_no = get4_cur ();
!   getws_cur (table, HEAP_LEN);
  
  
    if (!dic_in_envp (dic_no, envi))
diff -cNdr FreeWnn-1.1.1-a016.orig/Xsi/Wnn/jserver/do_env.c FreeWnn-1.1.1-a016/Xsi/Wnn/jserver/do_env.c
*** FreeWnn-1.1.1-a016.orig/Xsi/Wnn/jserver/do_env.c	Thu Feb 24 00:31:34 2000
--- FreeWnn-1.1.1-a016/Xsi/Wnn/jserver/do_env.c	Thu Mar  9 18:10:23 2000
***************
*** 60,70 ****
    char tmp_buf[256];
  
    version = get4_cur ();
!   gets_cur (tmp_buf);
!   tmp_buf[WNN_HOSTLEN - 1] = '\0';      /* truncate by WNN_HOSTLEN */
    strcpy (c_c->host_name, tmp_buf);
!   gets_cur (tmp_buf);
!   tmp_buf[WNN_ENVNAME_LEN - 1] = '\0';  /* truncate by WNN_ENVNAME_LEN */
    strcpy (c_c->user_name, tmp_buf);
    error1 ("Inet user=%s@%s\n", c_c->user_name, c_c->host_name);
    /* Moved to new_client, because del_client() will be called
--- 60,68 ----
    char tmp_buf[256];
  
    version = get4_cur ();
!   gets_cur (tmp_buf, WNN_HOSTLEN);
    strcpy (c_c->host_name, tmp_buf);
!   gets_cur (tmp_buf, WNN_ENVNAME_LEN);
    strcpy (c_c->user_name, tmp_buf);
    error1 ("Inet user=%s@%s\n", c_c->user_name, c_c->host_name);
    /* Moved to new_client, because del_client() will be called
***************
*** 111,117 ****
  {
    char n[256];
    register int x;
!   gets_cur (n);
    x = conn1 (n);
    if (x == -1)
      {
--- 109,115 ----
  {
    char n[256];
    register int x;
!   gets_cur (n, 256);
    x = conn1 (n);
    if (x == -1)
      {
***************
*** 187,193 ****
  {
    char n[256];
  
!   gets_cur (n);
    if (find_env_by_name (n) != -1)
      {                           /* exist */
        put4_cur (1);
--- 185,191 ----
  {
    char n[256];
  
!   gets_cur (n, 256);
    if (find_env_by_name (n) != -1)
      {                           /* exist */
        put4_cur (1);
diff -cNdr FreeWnn-1.1.1-a016.orig/Xsi/Wnn/jserver/do_filecom.c FreeWnn-1.1.1-a016/Xsi/Wnn/jserver/do_filecom.c
*** FreeWnn-1.1.1-a016.orig/Xsi/Wnn/jserver/do_filecom.c	Thu Feb 24 00:31:34 2000
--- FreeWnn-1.1.1-a016/Xsi/Wnn/jserver/do_filecom.c	Thu Mar  9 17:25:33 2000
***************
*** 75,81 ****
    int x;
    int err = 0;
    err = envhandle ();
!   get_file_name (path);
  
    if (err == -1)
      {
--- 75,81 ----
    int x;
    int err = 0;
    err = envhandle ();
!   get_file_name (path, FILENAME);
  
    if (err == -1)
      {
***************
*** 106,112 ****
    int eid;
  
    eid = envhandle ();
!   get_file_name (path);
    if (eid == -1)
      {
        error_ret ();
--- 106,112 ----
    int eid;
  
    eid = envhandle ();
!   get_file_name (path, FILENAME);
    if (eid == -1)
      {
        error_ret ();
***************
*** 139,145 ****
    int amode;
    envhandle ();
    amode = get4_cur ();
!   get_file_name (path);
  
  #ifdef WRITE_CHECK
    check_backup (path);
--- 139,145 ----
    int amode;
    envhandle ();
    amode = get4_cur ();
!   get_file_name (path, FILENAME);
  
  #ifdef WRITE_CHECK
    check_backup (path);
***************
*** 232,238 ****
    char n[FILENAME];
  
    get4_cur ();                  /* env_id */
!   get_file_name (n);
  
    put4_cur (file_stat (n));
    putc_purge ();
--- 232,238 ----
    char n[FILENAME];
  
    get4_cur ();                  /* env_id */
!   get_file_name (n, FILENAME);
  
    put4_cur (file_stat (n));
    putc_purge ();
***************
*** 381,389 ****
  
    env_id = get4_cur ();         /* env_id */
    fid = get4_cur ();
!   get_file_name (fn);
!   getws_cur (com);
!   gets_cur (hpasswd);
    if (find_fid_in_env (env_id, fid) == -1)
      {                           /* valid */
        wnn_errorno = WNN_FID_ERROR;
--- 381,389 ----
  
    env_id = get4_cur ();         /* env_id */
    fid = get4_cur ();
!   get_file_name (fn, FILE_NAME_L);
!   getws_cur (com, 1024);
!   gets_cur (hpasswd, WNN_PASSWD_LEN);
    if (find_fid_in_env (env_id, fid) == -1)
      {                           /* valid */
        wnn_errorno = WNN_FID_ERROR;
***************
*** 460,469 ****
    w_char com[1024];
    char passwd[WNN_PASSWD_LEN], hpasswd[WNN_PASSWD_LEN];
    get4_cur ();                  /* env_id */
!   get_file_name (fn);
!   getws_cur (com);
!   gets_cur (passwd);
!   gets_cur (hpasswd);
    type = get4_cur ();
  
    if (type != WNN_REV_DICT &&
--- 460,469 ----
    w_char com[1024];
    char passwd[WNN_PASSWD_LEN], hpasswd[WNN_PASSWD_LEN];
    get4_cur ();                  /* env_id */
!   get_file_name (fn, FILE_NAME_L);
!   getws_cur (com, 1024);
!   gets_cur (passwd, WNN_PASSWD_LEN);
!   gets_cur (hpasswd, WNN_PASSWD_LEN);
    type = get4_cur ();
  
    if (type != WNN_REV_DICT &&
***************
*** 502,508 ****
  
    envi = get4_cur ();           /* env_id */
    fid = get4_cur ();
!   getws_cur (comment);
  
    if (find_fid_in_env (envi, fid) == -1)
      {                           /* valid */
--- 502,508 ----
  
    envi = get4_cur ();           /* env_id */
    fid = get4_cur ();
!   getws_cur (comment, WNN_COMMENT_LEN);
  
    if (find_fid_in_env (envi, fid) == -1)
      {                           /* valid */
***************
*** 612,618 ****
    int x;
  
  /*  get4_cur(); env_id */
!   get_file_name (n);
  
    if ((x = file_loaded (n)) < 0)
      put4_cur (-1);
--- 612,618 ----
    int x;
  
  /*  get4_cur(); env_id */
!   get_file_name (n, FILE_NAME_L);
  
    if ((x = file_loaded (n)) < 0)
      put4_cur (-1);
***************
*** 741,747 ****
    put4_cur (1);
    putc_purge ();
  
!   gets_cur (n);
  
    /*     read file       */
    files[fid].localf = REMOTE;
--- 741,747 ----
    put4_cur (1);
    putc_purge ();
  
!   gets_cur (n, FILE_NAME_L);
  
    /*     read file       */
    files[fid].localf = REMOTE;
***************
*** 768,774 ****
    int env_id, fid;
  
    env_id = get4_cur ();         /* env_id */
!   get_file_name (n);
  
    fid = file_loaded (n);
    if (fid == -1)
--- 768,774 ----
    int env_id, fid;
  
    env_id = get4_cur ();         /* env_id */
!   get_file_name (n, FILE_NAME_L);
  
    fid = file_loaded (n);
    if (fid == -1)
***************
*** 850,856 ****
    char n[FILE_NAME_L];
    env_id = get4_cur ();         /* env_id */
    fid = get4_cur ();
!   get_file_name (n);
  
    if (find_fid_in_env (env_id, fid) == -1)
      {                           /* valid */
--- 850,856 ----
    char n[FILE_NAME_L];
    env_id = get4_cur ();         /* env_id */
    fid = get4_cur ();
!   get_file_name (n, FILE_NAME_L);
  
    if (find_fid_in_env (env_id, fid) == -1)
      {                           /* valid */
***************
*** 1051,1058 ****
    char passwd[WNN_PASSWD_LEN];
    int x;
  
!   get_file_name (n);
!   gets_cur (passwd);
  
    x = file_remove (n, passwd);
    if (x == -1)
--- 1051,1058 ----
    char passwd[WNN_PASSWD_LEN];
    int x;
  
!   get_file_name (n, FILE_NAME_L);
!   gets_cur (passwd, WNN_PASSWD_LEN);
  
    x = file_remove (n, passwd);
    if (x == -1)
***************
*** 1123,1130 ****
    envi = get4_cur ();           /* env_id */
    fid = get4_cur ();
    which = get4_cur ();
!   gets_cur (old);
!   gets_cur (new);
  
    if (find_fid_in_env (envi, fid) == -1)
      {
--- 1123,1130 ----
    envi = get4_cur ();           /* env_id */
    fid = get4_cur ();
    which = get4_cur ();
!   gets_cur (old, WNN_PASSWD_LEN);
!   gets_cur (new, WNN_PASSWD_LEN);
  
    if (find_fid_in_env (envi, fid) == -1)
      {
diff -cNdr FreeWnn-1.1.1-a016.orig/Xsi/Wnn/jserver/do_henkan.c FreeWnn-1.1.1-a016/Xsi/Wnn/jserver/do_henkan.c
*** FreeWnn-1.1.1-a016.orig/Xsi/Wnn/jserver/do_henkan.c	Thu Feb 24 00:31:34 2000
--- FreeWnn-1.1.1-a016/Xsi/Wnn/jserver/do_henkan.c	Thu Mar  9 17:25:33 2000
***************
*** 29,34 ****
--- 29,40 ----
   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   */
  
+ #include <config.h>
+ 
+ #if defined(HAVE_SYS_TYPES_H)
+ #include <sys/types.h>
+ #endif
+ 
  #include "commonhd.h"
  #include "jslib.h"
  #include "kaiseki.h"
diff -cNdr FreeWnn-1.1.1-a016.orig/Xsi/Wnn/jserver/do_henkan1.c FreeWnn-1.1.1-a016/Xsi/Wnn/jserver/do_henkan1.c
*** FreeWnn-1.1.1-a016.orig/Xsi/Wnn/jserver/do_henkan1.c	Thu Feb 24 00:31:34 2000
--- FreeWnn-1.1.1-a016/Xsi/Wnn/jserver/do_henkan1.c	Thu Mar  9 17:25:33 2000
***************
*** 29,37 ****
--- 29,43 ----
   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   */
  
+ #include <config.h>
+ 
  #include <stdio.h>
  #include <ctype.h>
  
+ #if defined(HAVE_SYS_TYPES_H)
+ #include <sys/types.h>
+ #endif
+ 
  #include "demcom.h"
  #include "commonhd.h"
  #include "de_header.h"
***************
*** 94,107 ****
  }
  
  static void
! get_fzk_vec (hinsi, fzk, vec, vec1)
       register int *hinsi;
       register int *vec;
       register int *vec1;
-      register w_char *fzk;
  {
    *hinsi = get4_cur ();
!   getws_cur (fzk);
    *vec = get4_cur ();
    *vec1 = get4_cur ();
  }
--- 100,114 ----
  }
  
  static void
! get_fzk_vec (hinsi, fzk, fzk_size, vec, vec1)
       register int *hinsi;
+      register w_char *fzk;
+      register size_t fzk_size;
       register int *vec;
       register int *vec1;
  {
    *hinsi = get4_cur ();
!   getws_cur (fzk, fzk_size);
    *vec = get4_cur ();
    *vec1 = get4_cur ();
  }
***************
*** 147,153 ****
    c_env = env[eid];
    end = maxchg - 1;
    err = henkan_setup ();
!   get_fzk_vec (&hinsi, fzk, &vec, &vec1);
    vec2 = get4_cur ();
    if (err == -1)
      {
--- 154,160 ----
    c_env = env[eid];
    end = maxchg - 1;
    err = henkan_setup ();
!   get_fzk_vec (&hinsi, fzk, FZK_L, &vec, &vec1);
    vec2 = get4_cur ();
    if (err == -1)
      {
***************
*** 203,209 ****
    c_env = env[eid];
    end = maxchg - 1;
    err = henkan_setup ();
!   get_fzk_vec (&hinsi, fzk, &vec, &vec1);
    if (err == -1)
      {
        error_ret ();             /* ERROR */
--- 210,216 ----
    c_env = env[eid];
    end = maxchg - 1;
    err = henkan_setup ();
!   get_fzk_vec (&hinsi, fzk, FZK_L, &vec, &vec1);
    if (err == -1)
      {
        error_ret ();             /* ERROR */
***************
*** 257,263 ****
    c_env = env[eid];
    end = maxchg - 1;
    err = henkan_setup ();
!   get_fzk_vec (&hinsi, fzk, &vec, &vec1);
    if (err == -1)
      {
        error_ret ();             /* ERROR */
--- 264,270 ----
    c_env = env[eid];
    end = maxchg - 1;
    err = henkan_setup ();
!   get_fzk_vec (&hinsi, fzk, FZK_L, &vec, &vec1);
    if (err == -1)
      {
        error_ret ();             /* ERROR */
***************
*** 311,317 ****
    c_env = env[eid];
    end = maxchg - 1;
    err = henkan_setup ();
!   get_fzk_vec (&hinsi, fzk, &vec, &vec1);
    if (err == -1)
      {
        error_ret ();             /* ERROR */
--- 318,324 ----
    c_env = env[eid];
    end = maxchg - 1;
    err = henkan_setup ();
!   get_fzk_vec (&hinsi, fzk, FZK_L, &vec, &vec1);
    if (err == -1)
      {
        error_ret ();             /* ERROR */
***************
*** 365,371 ****
    c_env = env[eid];
    end = maxchg - 1;
    err = henkan_setup ();
!   get_fzk_vec (&hinsi, fzk, &vec, &vec1);
    if (err == -1)
      {
        error_ret ();             /* ERROR */
--- 372,378 ----
    c_env = env[eid];
    end = maxchg - 1;
    err = henkan_setup ();
!   get_fzk_vec (&hinsi, fzk, FZK_L, &vec, &vec1);
    if (err == -1)
      {
        error_ret ();             /* ERROR */
diff -cNdr FreeWnn-1.1.1-a016.orig/Xsi/Wnn/jserver/initjserv.c FreeWnn-1.1.1-a016/Xsi/Wnn/jserver/initjserv.c
*** FreeWnn-1.1.1-a016.orig/Xsi/Wnn/jserver/initjserv.c	Thu Feb 24 00:31:36 2000
--- FreeWnn-1.1.1-a016/Xsi/Wnn/jserver/initjserv.c	Thu Mar  9 18:56:28 2000
***************
*** 29,36 ****
--- 29,43 ----
   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   */
  
+ #include <config.h>
+ 
  #include <stdio.h>
  #include <ctype.h>
+ 
+ #if defined(HAVE_SYS_TYPES_H)
+ #include <sys/types.h>
+ #endif
+ 
  #include "commonhd.h"
  #include "de_header.h"
  #include "wnn_malloc.h"
***************
*** 240,246 ****
        num = sscanf (data, "%s %s", code, file);
        if (strcmp (code, "readfile") == 0 && num == 2)
          {
!           read_default_file (file);
          }
      }
    fclose (fp);
--- 247,253 ----
        num = sscanf (data, "%s %s", code, file);
        if (strcmp (code, "readfile") == 0 && num == 2)
          {
!           read_default_file (file, 256);
          }
      }
    fclose (fp);
***************
*** 262,277 ****
  */
  
  static int
! read_default_file (n)
!      char *n;
  {
    int fid;
  
!   expand_file_name (n);
!   fid = file_loaded (n);
    if (fid == -1)
      {                           /* Not correct file */
!       printf ("Error reading %s\n", n);
        return (-1);
      }
    if (FILE_NOT_READ != fid)
--- 269,291 ----
  */
  
  static int
! read_default_file (buffer, buffer_size)
!      char *buffer;
!      size_t buffer_size;
  {
    int fid;
  
!   buffer = expand_file_name (buffer, buffer_size);
!   if (!buffer)
!     {
!       printf ("filename too long. %s\n", buffer);
!       return (-1);
!     }
! 
!   fid = file_loaded (buffer);
    if (fid == -1)
      {                           /* Not correct file */
!       printf ("Error reading %s\n", buffer);
        return (-1);
      }
    if (FILE_NOT_READ != fid)
***************
*** 280,295 ****
      }
    if ((fid = get_new_fid ()) == -1)
      {                           /* no more file */
!       printf ("Error reading %s\n", n);
        return (-1);
      }
  
    files[fid].localf = LOCAL;
!   strcpy (files[fid].name, n);
!   printf ("Reading %s\t Fid = %d\n", n, fid);
    if (read_file (&files[fid]) == -1)
      {
!       printf ("Error reading %s\n", n);
        files[fid].ref_count = -1;        /* fail */
        return (-1);
      }
--- 294,309 ----
      }
    if ((fid = get_new_fid ()) == -1)
      {                           /* no more file */
!       printf ("Error reading %s\n", buffer);
        return (-1);
      }
  
    files[fid].localf = LOCAL;
!   strcpy (files[fid].name, buffer);
!   printf ("Reading %s\t Fid = %d\n", buffer, fid);
    if (read_file (&files[fid]) == -1)
      {
!       printf ("Error reading %s\n", buffer);
        files[fid].ref_count = -1;        /* fail */
        return (-1);
      }
***************
*** 306,312 ****
  
    total = 0;
    flag = 0;
!   while (*st != NULL)
      {
        if (isdigit (*st))
          {
--- 320,326 ----
  
    total = 0;
    flag = 0;
!   while (*st != '\0')
      {
        if (isdigit (*st))
          {
diff -cNdr FreeWnn-1.1.1-a016.orig/Xsi/Wnn/jserver/jishoop.c FreeWnn-1.1.1-a016/Xsi/Wnn/jserver/jishoop.c
*** FreeWnn-1.1.1-a016.orig/Xsi/Wnn/jserver/jishoop.c	Thu Feb 24 00:31:37 2000
--- FreeWnn-1.1.1-a016/Xsi/Wnn/jserver/jishoop.c	Thu Mar  9 17:25:33 2000
***************
*** 29,35 ****
--- 29,42 ----
   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   */
  
+ #include <config.h>
+ 
  #include <stdio.h>
+ 
+ #if defined(HAVE_SYS_TYPES_H)
+ #include <sys/types.h>
+ #endif
+ 
  #include "commonhd.h"
  #include "de_header.h"
  #include "jdata.h"
diff -cNdr FreeWnn-1.1.1-a016.orig/Xsi/Wnn/jserver/malloc.c FreeWnn-1.1.1-a016/Xsi/Wnn/jserver/malloc.c
*** FreeWnn-1.1.1-a016.orig/Xsi/Wnn/jserver/malloc.c	Thu Feb 24 00:31:37 2000
--- FreeWnn-1.1.1-a016/Xsi/Wnn/jserver/malloc.c	Thu Mar  9 17:25:33 2000
***************
*** 29,35 ****
--- 29,42 ----
   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   */
  
+ #include <config.h>
+ 
  #include <stdio.h>
+ 
+ #if defined(HAVE_SYS_TYPES_H)
+ #include <sys/types.h>
+ #endif
+ 
  #include "wnn_malloc.h"
  #undef  malloc
  #undef  realloc
diff -cNdr FreeWnn-1.1.1-a016.orig/Xsi/Wnn/jserver/readfile.c FreeWnn-1.1.1-a016/Xsi/Wnn/jserver/readfile.c
*** FreeWnn-1.1.1-a016.orig/Xsi/Wnn/jserver/readfile.c	Thu Feb 24 00:31:38 2000
--- FreeWnn-1.1.1-a016/Xsi/Wnn/jserver/readfile.c	Thu Mar  9 17:25:33 2000
***************
*** 33,39 ****
--- 33,46 ----
    (Updatable, Stable) dictionary read routine.
  */
  
+ #include <config.h>
+ 
  #include <stdio.h>
+ 
+ #if defined(HAVE_SYS_TYPES_H)
+ #include <sys/types.h>
+ #endif
+ 
  #include "commonhd.h"
  #include "de_header.h"
  #include "jdata.h"
diff -cNdr FreeWnn-1.1.1-a016.orig/Xsi/config.h.in FreeWnn-1.1.1-a016/Xsi/config.h.in
*** FreeWnn-1.1.1-a016.orig/Xsi/config.h.in	Tue Feb  1 22:18:03 2000
--- FreeWnn-1.1.1-a016/Xsi/config.h.in	Thu Mar  9 17:25:33 2000
***************
*** 29,36 ****
   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   */
  
! #define HAVE_UNISTD_H 0
! 
  
  /* *_t が定義されているか? (定義されていればここでは undef になる) */
  #undef time_t
--- 29,36 ----
   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   */
  
! #undef HAVE_UNISTD_H
! #undef HAVE_SYS_TYPES_H
  
  /* *_t が定義されているか? (定義されていればここでは undef になる) */
  #undef time_t
diff -cNdr FreeWnn-1.1.1-a016.orig/Xsi/configure.in FreeWnn-1.1.1-a016/Xsi/configure.in
*** FreeWnn-1.1.1-a016.orig/Xsi/configure.in	Sun Feb 13 18:56:00 2000
--- FreeWnn-1.1.1-a016/Xsi/configure.in	Thu Mar  9 17:25:33 2000
***************
*** 234,240 ****
  AC_PATH_X
  AC_HEADER_STDC
  AC_HEADER_SYS_WAIT
! AC_CHECK_HEADERS(fcntl.h limits.h malloc.h sgtty.h strings.h sys/file.h sys/ioctl.h sys/time.h termio.h unistd.h)
  
  dnl
  dnl Checks for typedefs, structures, and compiler characteristics.
--- 234,240 ----
  AC_PATH_X
  AC_HEADER_STDC
  AC_HEADER_SYS_WAIT
! AC_CHECK_HEADERS(fcntl.h limits.h malloc.h sgtty.h strings.h sys/file.h sys/ioctl.h sys/time.h termio.h unistd.h sys/types.h)
  
  dnl
  dnl Checks for typedefs, structures, and compiler characteristics.