|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2014-08-19 18:39 UTC] Laurent dot Lyaudet at gmail dot com
-Status: Open
+Status: Closed
[2014-08-19 18:39 UTC] Laurent dot Lyaudet at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 20 06:00:01 2025 UTC |
Description: ------------ Hi, Single quotes are not properly escaped by escapeshellargs. The correction is trivial. Current source code in exec.c is 363 switch (str[x]) { 364 #ifdef PHP_WIN32 365 case '"': 366 case '%': 367 cmd->val[y++] = ' '; 368 break; 369 #else 370 case '\'': 371 cmd->val[y++] = '\''; 372 cmd->val[y++] = '\\'; 373 cmd->val[y++] = '\''; 374 #endif 375 /* fall-through */ 376 default: 377 cmd->val[y++] = str[x]; 378 } line 371 should be removed and a line with 'break;' should be added between lines 373 and 374. Correct source code should be 363 switch (str[x]) { 364 #ifdef PHP_WIN32 365 case '"': 366 case '%': 367 cmd->val[y++] = ' '; 368 break; 369 #else 370 case '\'': 371 cmd->val[y++] = '\\'; 372 cmd->val[y++] = '\''; 373 break; 374 #endif 375 /* fall-through */ 376 default: 377 cmd->val[y++] = str[x]; 378 } Best regards, Laurent Lyaudet Test script: --------------- root@wheezyDEVLaurent:~# php <?php echo "\n", escapeshellarg('\''), "\n"; ?> ''\''' root@wheezyDEVLaurent:~# Expected result: ---------------- '\'' Actual result: -------------- ''\'''