diff src/intl-win32.c @ 3648:3e7493e76dc7

[xemacs-hg @ 2006-11-01 20:25:48 by adrian] fix for ffap crash on Windows (was: [Bug: 21.5-b27] [CRASH] (file-name-directory "1:")) -------------------- ChangeLog entries follow: -------------------- src/ChangeLog addition: 2006-11-01 Adrian Aichner <adrian@xemacs.org> * sysdep.c (wcslen): Check for NULL pointer. * sysdep.c (strlwr): Ditto. * nt.c (mswindows_getdcwd): Ditto (actual cause of reported crash). * intl-win32.c (wcscmp): Ditto. * intl-win32.c (wcslen): Ditto. * intl-win32.c (wcsncpy): Ditto. * intl-win32.c (wcscpy): Ditto. * intl-win32.c (wcsdup): Ditto. * fileio.c (Ffile_name_directory): Return Qnil when mswindows_getdcwd returns NULL working directory.
author adrian
date Wed, 01 Nov 2006 20:25:50 +0000
parents 9905c1e522b8
children 6b2ef948e140
line wrap: on
line diff
--- a/src/intl-win32.c	Tue Oct 31 22:51:31 2006 +0000
+++ b/src/intl-win32.c	Wed Nov 01 20:25:50 2006 +0000
@@ -1569,6 +1569,7 @@
 int
 wcscmp (const wchar_t *s1, const wchar_t *s2)
 {
+  if (s1 == NULL || s2 == NULL) return NULL;
   while (*s1 != '\0' && *s1 == *s2)
     {
       s1++;
@@ -1585,6 +1586,7 @@
 size_t
 wcslen (const wchar_t *str)
 {
+  if (str == NULL) return NULL;
   const wchar_t *start = str;
 
   while (*str)
@@ -1598,6 +1600,7 @@
 wchar_t *
 wcsncpy (wchar_t *dst0, const wchar_t *src0, size_t count)
 {
+  if (dst0 == NULL || src0 == NULL) return NULL;
   wchar_t *dscan;
   const wchar_t *sscan;
 
@@ -1618,6 +1621,7 @@
 wchar_t *
 wcscpy (wchar_t *dst0, const wchar_t *src0)
 {
+  if (dst0 == NULL || src0 == NULL) return NULL;
   wchar_t *s = dst0;
 
   while ((*dst0++ = *src0++))
@@ -1629,6 +1633,7 @@
 wchar_t *
 wcsdup (const wchar_t *str)
 {
+  if (str == NULL) return NULL;
   int len = wcslen (str) + 1;
   wchar_t *val = xnew_array (wchar_t, len);