mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-03-19 18:00:23 +08:00
changed sprintf to more secure snprintf to prevent vulnerability to buffer
overflow exploits.
This commit is contained in:
parent
83b2809a03
commit
fcc50aec8a
4
labels.c
4
labels.c
@ -221,7 +221,7 @@ if (pass0 == 1) {
|
||||
slen += strlen(lpostfix);
|
||||
slen++; /* room for that null char */
|
||||
xsymbol = nasm_malloc(slen);
|
||||
sprintf(xsymbol,"%s%s%s",lprefix,lptr->defn.label,lpostfix);
|
||||
snprintf(xsymbol,slen,"%s%s%s",lprefix,lptr->defn.label,lpostfix);
|
||||
|
||||
ofmt->symdef (xsymbol, segment, offset, exi,
|
||||
special ? special : lptr->defn.special);
|
||||
@ -286,7 +286,7 @@ if (pass0 == 1 || (!is_norm && !isextrn && (segment&1))) {
|
||||
slen += strlen(lpostfix);
|
||||
slen++; /* room for that null char */
|
||||
xsymbol = nasm_malloc(slen);
|
||||
sprintf(xsymbol,"%s%s%s",lprefix,lptr->defn.label,lpostfix);
|
||||
snprintf(xsymbol,slen,"%s%s%s",lprefix,lptr->defn.label,lpostfix);
|
||||
|
||||
ofmt->symdef (xsymbol, segment, offset, exi,
|
||||
special ? special : lptr->defn.special);
|
||||
|
@ -192,7 +192,7 @@ static void list_output (long offset, const void *data, unsigned long type)
|
||||
else if (typ == OUT_RESERVE)
|
||||
{
|
||||
char q[20];
|
||||
sprintf(q, "<res %08lX>", size);
|
||||
snprintf(q, sizeof(q), "<res %08lX>", size);
|
||||
list_out (offset, q);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user