aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/pam-freerdp.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/pam-freerdp.c b/src/pam-freerdp.c
index 440ee40..0277e0c 100644
--- a/src/pam-freerdp.c
+++ b/src/pam-freerdp.c
@@ -92,13 +92,12 @@ get_item (pam_handle_t * pamh, int type)
if ((subloc = strstr(retval, "://")) != NULL) {
char * original = retval;
char * newish = retval + strlen("://");
- char * c;
- for (c = newish; *c != '\0'; c++) {
- if (*c == '/') {
- *c = '\0';
- break;
- }
+ char * c = strstr(newish, "/");
+
+ if (c != NULL) {
+ c[0] = '\0';
}
+
retval = strdup(newish);
free(original);
}