Bug in Windows Mobile 5.0 Managed Telephony API

You Can Take it With You

Syndication

News

  • Don't miss the next Windows Mobile Webcast... Unit Testing for Mobile Devices: http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032382824&EventCategory=4&culture=en-US&CountryCode=US.
The addition of the Microsoft.WindowsMobile.Telephony assembly in the Windows Mobile 5.0 PocketPC/Smartphone SDKs makes dialing the device telephone using the .NET Compact Framework about as easy as it gets.
 
  Phone myPhone = new Phone();
  myPhone.Talk("6035551212");
 
As you would expect, the managed implementation of talk actually calls the native function PhoneMakeCall. Well it turns out that there's a bug in the implementation of Phone.Talk where the string containing the phone number is passed to PhoneMakeCall without adding null termination.
 
As a result, just like when passing a non-null terminated string in C/C++, you'll get random results when calling Phone.Talk. Sometimes it will work, sometimes it will add random characters to the end of the phone number. It may even potentially crash.
 
Fortunately the fix is easy; explicitly include the null termination when calling Phone.Talk.
 
  Phone myPhone = new Phone();
  myPhone.Talk("6035551212\0");
 
Although easily fixed, this problem could be a nightmare if not addressed. You'll want to be sure and verify that you handle this bug.

Posted Jan 20 2006, 04:13 PM by jim-wilson

Comments

Aaron Weiker wrote re: Bug in Windows Mobile 5.0 Managed Telephony API
on 01-31-2006 5:01 AM
You mentioned that you'll definately want to address this, while I agree I do have one question. What happens when the bug is fixed? Will it attempt to dial a number w/ a null terminated string, or will the extra null be removed?
You Can Take it With You wrote Windows Mobile 5.0 Managed Telephony API Bug - What happens when the bug is fixed?
on 01-31-2006 12:46 PM

Add a Comment

(required)  
(optional)
(required)  
Remember Me?