-
-
Notifications
You must be signed in to change notification settings - Fork 340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EXC_BAD_ACCESS if ICE server config contains usernames with %40 instead of @ #157
Comments
Good catch. However I expect this to happen in much more cases as the plugin is logging user entered input. I mean: if the user calls So AIFAU this must be sanitized in the Swift code rather than in JS land. And this should be done by adding a new Swift module that internally calls Does it make sense? A PR handling this would be really welcome :) |
Or perhaps I should refactor how input is given to
use this:
? |
I'm not a Swift expert (learned it a while ago and haven't use it often since), so I'm not sure if switching the syntax to %s will help, but I would give it a shot (have you tried this already?). Easier than replacing all NSLogs() by a custom module. But this would be the next option. |
Unfortunately I won't be able to try it for a while... |
OK, I will check if it is possible and give feedback. Currently, I am using my own fork anyway, since I am waiting for your feedback on PR #154. |
@derwaldgeist I've got some time today to work on the plugin and I'm handling other pending issues/PRs. If you could test whether using my above suggestion (at least in the crashing line) fixes the problem, please comment it and I'll fix all the other calls to |
@ibc: I just tested it the minute you posted your comment :-) And yes, the %s fix works! |
Great! I will fix all the other cases. |
Oops, accidentally closed the issue. |
Perfect! |
One more thing, may you please check what happens if NSLog("PluginRTCPeerConnectionConfig#init() | adding ICE server [url:%s, username:%s, password:%s]", url!, username, password) |
I think I've got the solution:
prints:
|
There are free TURN servers hosted by Viagenie:
http://numb.viagenie.ca/
If you register for an account, your credentials will look like that:
The %40 causes the iosrtc plugin to break with EXC_BAD_ACCESS at this line:
https://github.com/eface2face/cordova-plugin-iosrtc/blob/master/src/PluginRTCPeerConnectionConfig.swift#L23
NSLog requires % signs to be escaped with %%, since they have a special meaning:
https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Strings/Articles/formatSpecifiers.html#//apple_ref/doc/uid/TP40004265
If I change the %40 to @, it works. But %40 is valid and used by providers like Viagenie, so I think it should be supported by the plugin.
It can be fixed like this:
I can create a PR for this if you want to.
The text was updated successfully, but these errors were encountered: