Skip to content

Commit

Permalink
droidvnc-ng.c: Changed default action in case of errors
Browse files Browse the repository at this point in the history
Contrary to before, now, if some error occurs during address translation, it is reported, instead of using the 0.0.0.0 address.
  • Loading branch information
elluisian committed Aug 30, 2024
1 parent 4089ebc commit 65af87f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions app/src/main/cpp/droidvnc-ng.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,13 +317,18 @@ JNIEXPORT jboolean JNICALL Java_net_christianbeier_droidvnc_1ng_MainService_vncS

in_addr_t address = 0; // Default is 0.0.0.0
if (listenIf != NULL) {
const char *listenIfNative = (*env)->GetStringUTFChars(env, listenIf, NULL);
if (!rfbStringToAddr((char*)listenIfNative, &address)) {
address = 0; // If problems arise, assume 0.0.0.0
const char *cListenInterface = (*env)->GetStringUTFChars(env, listenIf, NULL);
int addrConvSucceded = rfbStringToAddr((char*)cListenInterface, &address);
(*env)->ReleaseStringUTFChars(env, listenIf, cListenInterface);

if (!addrConvSucceded) {
__android_log_print(ANDROID_LOG_ERROR, TAG, "vncStartServer: invalid listen address");
Java_net_christianbeier_droidvnc_1ng_MainService_vncStopServer(env, thiz);
return JNI_FALSE;
}
(*env)->ReleaseStringUTFChars(env, listenIf, listenIfNative);
}


// With the listenInterface property one can define where the server will be available
theScreen->listenInterface = address;
theScreen->port = port;
Expand Down

0 comments on commit 65af87f

Please sign in to comment.