Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.9 KiB

  1. //***************************************************************************
  2. //This script tests array out-of-bounds conditions on properties and
  3. //qualifiers
  4. //***************************************************************************
  5. var Service = GetObject("winmgmts:root/default");
  6. var Class = Service.Get();
  7. Class.Path_.Class = "ARRAYPROP00";
  8. var Property = Class.Properties_.Add ("p1", 19, true);
  9. Property.Value = new Array (12, 787, 34124);
  10. var Qualifier = Property.Qualifiers_.Add("wibble", new Array ("fred", "the", "hamster"));
  11. //************************************************************
  12. // PROPERTY
  13. //************************************************************
  14. //Out-of-bounds write ; should expand the array
  15. Class.Properties_("p1")(3) = 783837;
  16. //Now read should be in bounds
  17. WScript.Echo ("Value of ARRAYPROP00.Class.p1(3) is [783837]:",
  18. (new VBArray(Class.Properties_("p1").Value).toArray ())[3]);
  19. //Out-of-bounds write ; should expand the array
  20. Class.p1(4) = 783844;
  21. //Now read should be in bounds
  22. WScript.Echo ("Value of ARRAYPROP00.Class.p1(4) is [783844]:",
  23. (new VBArray(Class.Properties_("p1").Value).toArray ())[4]);
  24. //Complete value dump
  25. var arrayVal = new VBArray(Class.Properties_("p1").Value).toArray ();
  26. for (i = 0; i < arrayVal.length; i++)
  27. WScript.Echo(arrayVal[i]);
  28. //************************************************************
  29. // QUALIFIER
  30. //************************************************************
  31. //Out-of-bounds write ; should expand the array
  32. Property.Qualifiers_("wibble")(3) = "jam";
  33. //Now read should be in bounds
  34. WScript.Echo ("Value of qualifier(3) is [jam]:",
  35. (new VBArray(Property.Qualifiers_("wibble").Value).toArray())[3]);
  36. //Complete value dump
  37. var arrayVal = new VBArray(Property.Qualifiers_("wibble").Value).toArray ();
  38. for (i = 0; i < arrayVal.length; i++)
  39. WScript.Echo(arrayVal[i]);