GUAC-363: Warn of invalid preconnection IDs.

This commit is contained in:
Michael Jumper 2015-11-03 15:41:28 -08:00
parent b47cff044e
commit 5d608b3500

View File

@ -780,11 +780,23 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
/* Preconnection ID */
settings->preconnection_id = -1;
if (argv[IDX_PRECONNECTION_ID][0] != '\0') {
settings->preconnection_id = atoi(argv[IDX_PRECONNECTION_ID]);
/* Parse preconnection ID, warn if invalid */
int preconnection_id = atoi(argv[IDX_PRECONNECTION_ID]);
if (preconnection_id < 0)
guac_client_log(client, GUAC_LOG_WARNING,
"Ignoring invalid preconnection ID: %i",
preconnection_id);
/* Otherwise, assign specified ID */
else {
settings->preconnection_id = preconnection_id;
guac_client_log(client, GUAC_LOG_DEBUG,
"Preconnection ID: %i", settings->preconnection_id);
}
}
/* Preconnection BLOB */
settings->preconnection_blob = NULL;
if (argv[IDX_PRECONNECTION_BLOB][0] != '\0') {