Apple has released a new software update that should fix a bug that made it possible to get past an iPhone lockscreen and access the device’s phone functions, the company said.

The flaw, discovered last month, gave anyone access to a locked iPhone’s photo library and contacts list by pressing on the power button and using the phone’s emergency call option.

From the contacts list, users can send e-mails, text messages and make FaceTime calls, making the flaw particularly troubling. Apple released a statement when the bug was discovered, saying that it would move quickly to patch the hole.

The update is rolling out to iPhone users, but should be available to all those affected by the bug. Users should upgrade their operating systems as soon as possible to protect their devices.

ZDNet noted earlier this month that a similar flaw exists for the Samsung Galaxy S III, that also gives anyone access to a locked device using the emergency call and power buttons.

Samsung said on its company blog that it will be releasing its own update “shortly” and recommends that users update their devices as quickly as possible when the new software is rolled out to its users.

Apple owners should receive word of an update automatically from a pop-up message on their phones, but can also check for system updates in the “General” menu of their phones or by connecting to iTunes. According to a post on Apple’s support forums, the update also makes improvements to the Maps app for Japanese customers .

Related stories:

New iPhone ‘hack’ lets users bypass the lockscreen

BlackBerry CEO: Apple’s iPhone is outdated

Samsung developing wristwatch, looks to get ahead of Apple

Sign up today to receive #thecircuit, a daily roundup of the latest tech policy news from Washington and how it is shaping business, entertainment and science.