summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Engestrom <eric.engestrom@imgtec.com>2017-07-07 11:23:48 +0100
committerEmil Velikov <emil.l.velikov@gmail.com>2017-09-07 13:52:27 +0100
commit43644931cb9cb5cc92391f6f5431535b9b7a3f24 (patch)
tree9faa7076a2a0373c7217388d3513c837633c64aa
parente8c21056134498c49733f6baf572ffbb051ed886 (diff)
Make sure string is never NULL
`error_message` is passed in to strncpy() without any check, which doesn't handle NULL itself, so let's make it a valid empty string in cases where it was NULL. Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com> Acked-by: Walter Harms <wharms@bfs.de> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
-rw-r--r--src/process.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/process.c b/src/process.c
index 9cd744b..5e00be3 100644
--- a/src/process.c
+++ b/src/process.c
@@ -704,6 +704,11 @@ ProcessError (
invokeHandler = 1;
}
+ if (!errorStr)
+ {
+ errorStr = strdup("");
+ }
+
errorReply->type = ICE_CONNECTION_ERROR;
errorReply->error_message = errorStr;
}
@@ -794,6 +799,11 @@ ProcessError (
invokeHandler = 1;
}
+ if (!errorStr)
+ {
+ errorStr = strdup("");
+ }
+
errorReply->type = ICE_PROTOCOL_ERROR;
errorReply->error_message = errorStr;
}
@@ -1270,7 +1280,7 @@ ProcessAuthRequired (
}
if (asprintf (&returnErrorString, "%s%s", prefix, errorString) == -1)
- returnErrorString = NULL;
+ returnErrorString = strdup("");
free (errorString);
if (iceConn->connect_to_you)
@@ -1697,7 +1707,7 @@ ProcessAuthNextPhase (
}
if (asprintf (&returnErrorString, "%s%s", prefix, errorString) == -1)
- returnErrorString = NULL;
+ returnErrorString = strdup("");
free (errorString);
if (iceConn->connect_to_you)