win-pvdrivers

changeset 626:1c466f05ad73

advance the pointer only by the number of bytes actually copied and not the length of the original string
author Amir Szekely <amir@neocleus.com>
date Mon Aug 17 14:36:11 2009 +0300 (2009-08-17)
parents c9fd1186ecce
children 14086fb4104b
files common/include/xen_windows.h
line diff
     1.1 --- a/common/include/xen_windows.h	Sat Aug 08 10:29:34 2009 +0300
     1.2 +++ b/common/include/xen_windows.h	Mon Aug 17 14:36:11 2009 +0300
     1.3 @@ -492,8 +492,9 @@ static __inline VOID
     1.4  __ADD_XEN_INIT_STRING(PUCHAR *ptr, PCHAR val)
     1.5  {
     1.6  //  KdPrint((__DRIVER_NAME "     ADD_XEN_INIT_STRING *ptr = %p, val = %s\n", *ptr, val));
     1.7 -  RtlStringCbCopyA((PCHAR)*ptr, PAGE_SIZE - (PtrToUlong(*ptr) & (PAGE_SIZE - 1)), val);
     1.8 -  *ptr += strlen(val) + 1;
     1.9 +  size_t max_string_size = PAGE_SIZE - (PtrToUlong(*ptr) & (PAGE_SIZE - 1));
    1.10 +  RtlStringCbCopyA((PCHAR)*ptr, max_string_size, val);
    1.11 +  *ptr += min(strlen(val) + 1, max_string_size);
    1.12  }
    1.13  
    1.14  static __inline UCHAR