argument of --asm= or --link= to allow for
--asm="sh script --options", the user can double quote the
argument if needed: --asm="'c:/program files/gpasm' -q",
also fix some potential buffer overflows
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@5274
4a8a32a2-be11-0410-ad9d-
d568d2c75423
+2008-11-24 Raphael Neider <rneider AT web.de>
+
+ * src/pic16/main.c (_pic16_finaliseOptions): do not quote the
+ argument of --asm= or --link= to allow for
+ --asm="sh script --options", the user can double quote the
+ argument if needed: --asm="'c:/program files/gpasm' -q",
+ also fix some potential buffer overflows
+
2008-11-19 Borut Razem <borut.razem AT siol.net>
* doc/sdccman.lyx:
2008-11-19 Borut Razem <borut.razem AT siol.net>
* doc/sdccman.lyx:
size_t len = strlen(alt_asm);
char *cmd = malloc(len + 3);
size_t len = strlen(alt_asm);
char *cmd = malloc(len + 3);
- cmd[0] = '"';
- memcpy(&cmd[1], alt_asm, len);
- cmd[len + 1] = '"';
- cmd[len + 2] = '\0';
- pic16_linkCmd[0] = cmd;
+ if (0)
+ {
+ // fails for --asm="/bin/sh script.sh --options"
+ cmd[0] = '"';
+ memcpy(&cmd[1], alt_asm, len);
+ cmd[len + 1] = '"';
+ cmd[len + 2] = '\0';
+ }
+ else
+ {
+ // requires --asm="'my prog with spaces'"
+ memcpy(&cmd[0], alt_asm, len);
+ cmd[len] = 0;
+ }
+ pic16_asmCmd[0] = cmd;
}
if (alt_link && alt_link[0] != '\0')
{
}
if (alt_link && alt_link[0] != '\0')
{
- size_t len = strlen(alt_asm);
+ size_t len = strlen(alt_link);
char *cmd = malloc(len + 3);
char *cmd = malloc(len + 3);
- cmd[0] = '"';
- memcpy(&cmd[1], alt_link, len);
- cmd[len + 1] = '"';
- cmd[len + 2] = '\0';
+ if (0)
+ {
+ // fails for --link="/bin/sh script.sh --options"
+ cmd[0] = '"';
+ memcpy(&cmd[1], alt_link, len);
+ cmd[len + 1] = '"';
+ cmd[len + 2] = '\0';
+ }
+ else
+ {
+ // requires --link="'my prog with spaces'"
+ memcpy(&cmd[0], alt_link, len);
+ cmd[len] = 0;
+ }
pic16_linkCmd[0] = cmd;
}
pic16_linkCmd[0] = cmd;
}
- if (!pic16_options.no_crt)
+ if (!pic16_options.no_crt)
{
pic16_options.omit_ivt = 1;
pic16_options.leave_reset = 0;
}
{
pic16_options.omit_ivt = 1;
pic16_options.leave_reset = 0;
}
- if (options.model == MODEL_SMALL)
- addSet(&asmOptionsSet, Safe_strdup("-DSDCC_MODEL_SMALL"));
+ if (options.model == MODEL_SMALL)
+ {
+ addSet(&asmOptionsSet, Safe_strdup("-DSDCC_MODEL_SMALL"));
+ }
else if(options.model == MODEL_LARGE)
{
char buf[128];
else if(options.model == MODEL_LARGE)
{
char buf[128];
addSet(&asmOptionsSet, Safe_strdup(buf));
}
addSet(&asmOptionsSet, Safe_strdup(buf));
}
{
addSet(&preArgvSet, Safe_strdup("-DSTACK_MODEL_LARGE"));
addSet(&asmOptionsSet, Safe_strdup("-DSTACK_MODEL_LARGE"));
{
addSet(&preArgvSet, Safe_strdup("-DSTACK_MODEL_LARGE"));
addSet(&asmOptionsSet, Safe_strdup("-DSTACK_MODEL_LARGE"));