1  long (*extfunc)();
       2  
       3  static inline void lstrcpynW( short *d, const short *s, int n )
       4  {
       5      unsigned int count = n;
       6  
       7      while ((count > 1) && *s)
       8      {
       9          count--;
      10          *d++ = *s++;
      11      }
      12      if (count) *d = 0;
      13  }
      14  
      15  int __attribute__((noinline,noclone))
      16  badfunc(int u0, int u1, int u2, int u3,
      17    short *fsname, unsigned int fsname_len)
      18  {
      19      static const short ntfsW[] = {'N','T','F','S',0};
      20      char superblock[2048+3300];
      21      int ret = 0;
      22      short *p;
      23  
      24      if (extfunc())
      25          return 0;
      26      p = (void *)extfunc();
      27      if (p != 0)
      28          goto done;
      29  
      30      extfunc(superblock);
      31  
      32      lstrcpynW(fsname, ntfsW, fsname_len);
      33  
      34      ret = 1;
      35  done:
      36      return ret;
      37  }
      38  
      39  static long f()
      40  {
      41      return 0;
      42  }
      43  
      44  int main()
      45  {
      46      short buf[6];
      47      extfunc = f;
      48      return !badfunc(0, 0, 0, 0, buf, 6);
      49  }