Explorar o código

Add strdup to start-stop-daemon

Wichert Akkerman %!s(int64=27) %!d(string=hai) anos
pai
achega
b3b861c1ac
Modificáronse 1 ficheiros con 4 adicións e 1 borrados
  1. 4 1
      utils/start-stop-daemon.c

+ 4 - 1
utils/start-stop-daemon.c

@@ -311,7 +311,10 @@ parse_options(int argc, char * const *argv)
 			execname = optarg;
 			break;
 		case 'c':  /* --chuid <username>|<uid> */
-			changeuser = strtok(optarg, ":");
+			/* we copy the string just in case we need the
+			 * argument later. */
+			changeuser = strdup(optarg);
+			changeuser = strtok(changeuser, ":");
 			changegroup = strtok(NULL, ":");
 			break;
 		case 'b':  /* --background */