aboutsummaryrefslogtreecommitdiff
path: root/devel/nasm
diff options
context:
space:
mode:
authorKirill Ponomarev <krion@FreeBSD.org>2005-01-24 23:14:54 +0000
committerKirill Ponomarev <krion@FreeBSD.org>2005-01-24 23:14:54 +0000
commit944b992305008017fec163a65161c019b01852fb (patch)
tree6429eb3f4fef8fd883e24de2d8665239432f8a2b /devel/nasm
parent8fdaf5d1e795b23d80ea3ed362013506875dd423 (diff)
downloadports-944b992305008017fec163a65161c019b01852fb.tar.gz
ports-944b992305008017fec163a65161c019b01852fb.zip
Notes
Diffstat (limited to 'devel/nasm')
-rw-r--r--devel/nasm/Makefile7
-rw-r--r--devel/nasm/distinfo4
-rw-r--r--devel/nasm/files/patch-disasm.c194
-rw-r--r--devel/nasm/files/patch-disasm.h17
-rw-r--r--devel/nasm/files/patch-labels.c23
-rw-r--r--devel/nasm/files/patch-listing.c14
-rw-r--r--devel/nasm/files/patch-nasm.c14
-rw-r--r--devel/nasm/files/patch-ndisasm.c18
-rw-r--r--devel/nasm/files/patch-output::outelf.c23
-rw-r--r--devel/nasm/files/patch-preproc.c223
10 files changed, 20 insertions, 517 deletions
diff --git a/devel/nasm/Makefile b/devel/nasm/Makefile
index a6d7a71ad4ff..2d70267c09b9 100644
--- a/devel/nasm/Makefile
+++ b/devel/nasm/Makefile
@@ -6,8 +6,7 @@
#
PORTNAME= nasm
-PORTVERSION= 0.98.38
-PORTREVISION= 2
+PORTVERSION= 0.98.39
PORTEPOCH= 1
CATEGORIES= devel lang
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
@@ -17,6 +16,7 @@ MAINTAINER= krion@FreeBSD.org
COMMENT= General-purpose multi-platform x86 assembler
USE_BZIP2= yes
+USE_REINPLACE= yes
GNU_CONFIGURE= yes
CONFIGURE_TARGET=--build=${MACHINE_ARCH}-portbld-freebsd${OSREL}
PLIST_SUB= VERSION=${PORTVERSION}
@@ -25,6 +25,9 @@ PLIST_FILES= bin/nasm bin/nasm-%%VERSION%% bin/ndisasm
MAN1= nasm.1 ndisasm.1
+post-patch:
+ @${REINPLACE_CMD} -e 's|-std=c99||' ${WRKSRC}/configure
+
post-install:
${LN} -sf nasm ${PREFIX}/bin/${DISTNAME}
diff --git a/devel/nasm/distinfo b/devel/nasm/distinfo
index d914cbede563..3f72af882085 100644
--- a/devel/nasm/distinfo
+++ b/devel/nasm/distinfo
@@ -1,2 +1,2 @@
-MD5 (nasm-0.98.38.tar.bz2) = 9f682490c132b070d54e395cb6ee145e
-SIZE (nasm-0.98.38.tar.bz2) = 548618
+MD5 (nasm-0.98.39.tar.bz2) = 2032ad44c7359f7a9a166a40a633e772
+SIZE (nasm-0.98.39.tar.bz2) = 543976
diff --git a/devel/nasm/files/patch-disasm.c b/devel/nasm/files/patch-disasm.c
deleted file mode 100644
index cb014628b0df..000000000000
--- a/devel/nasm/files/patch-disasm.c
+++ /dev/null
@@ -1,194 +0,0 @@
-
-$FreeBSD$
-
---- disasm.c.orig
-+++ disasm.c
-@@ -484,8 +484,8 @@
- return data - origdata;
- }
-
--long disasm (unsigned char *data, char *output, int segsize, long offset,
-- int autosync, unsigned long prefer)
-+long disasm (unsigned char *data, char *output, int outbufsize, int segsize,
-+ long offset, int autosync, unsigned long prefer)
- {
- struct itemplate **p, **best_p;
- int length, best_length = 0;
-@@ -582,27 +582,34 @@
-
- slen = 0;
-
-+ /* TODO: snprintf returns the value that the string would have if
-+ * the buffer were long enough, and not the actual length of
-+ * the returned string, so each instance of using the return
-+ * value of snprintf should actually be checked to assure that
-+ * the return value is "sane." Maybe a macro wrapper could
-+ * be used for that purpose.
-+ */
- if (lock)
-- slen += sprintf(output+slen, "lock ");
-+ slen += snprintf(output+slen, outbufsize-slen, "lock ");
- for (i = 0; i < ins.nprefix; i++)
- switch (ins.prefixes[i]) {
-- case P_REP: slen += sprintf(output+slen, "rep "); break;
-- case P_REPE: slen += sprintf(output+slen, "repe "); break;
-- case P_REPNE: slen += sprintf(output+slen, "repne "); break;
-- case P_A16: slen += sprintf(output+slen, "a16 "); break;
-- case P_A32: slen += sprintf(output+slen, "a32 "); break;
-- case P_O16: slen += sprintf(output+slen, "o16 "); break;
-- case P_O32: slen += sprintf(output+slen, "o32 "); break;
-+ case P_REP: slen += snprintf(output+slen, outbufsize-slen, "rep "); break;
-+ case P_REPE: slen += snprintf(output+slen, outbufsize-slen, "repe "); break;
-+ case P_REPNE: slen += snprintf(output+slen, outbufsize-slen, "repne "); break;
-+ case P_A16: slen += snprintf(output+slen, outbufsize-slen, "a16 "); break;
-+ case P_A32: slen += snprintf(output+slen, outbufsize-slen, "a32 "); break;
-+ case P_O16: slen += snprintf(output+slen, outbufsize-slen, "o16 "); break;
-+ case P_O32: slen += snprintf(output+slen, outbufsize-slen, "o32 "); break;
- }
-
- for (i = 0; i < elements(ico); i++)
- if ((*p)->opcode == ico[i]) {
-- slen += sprintf(output+slen, "%s%s", icn[i],
-+ slen += snprintf(output+slen, outbufsize-slen, "%s%s", icn[i],
- whichcond(ins.condition));
- break;
- }
- if (i >= elements(ico))
-- slen += sprintf(output+slen, "%s", insn_names[(*p)->opcode]);
-+ slen += snprintf(output+slen, outbufsize-slen, "%s", insn_names[(*p)->opcode]);
- colon = FALSE;
- length += data - origdata; /* fix up for prefixes */
- for (i=0; i<(*p)->operands; i++) {
-@@ -633,14 +640,14 @@
- ins.oprs[i].basereg = whichreg ((*p)->opd[i],
- ins.oprs[i].basereg);
- if ( (*p)->opd[i] & TO )
-- slen += sprintf(output+slen, "to ");
-- slen += sprintf(output+slen, "%s",
-+ slen += snprintf(output+slen, outbufsize-slen, "to ");
-+ slen += snprintf(output+slen, outbufsize-slen, "%s",
- reg_names[ins.oprs[i].basereg-EXPR_REG_START]);
- } else if (!(UNITY & ~(*p)->opd[i])) {
- output[slen++] = '1';
- } else if ( (*p)->opd[i] & IMMEDIATE ) {
- if ( (*p)->opd[i] & BITS8 ) {
-- slen += sprintf(output+slen, "byte ");
-+ slen += snprintf(output+slen, outbufsize-slen, "byte ");
- if (ins.oprs[i].segment & SEG_SIGNED) {
- if (ins.oprs[i].offset < 0) {
- ins.oprs[i].offset *= -1;
-@@ -649,17 +656,17 @@
- output[slen++] = '+';
- }
- } else if ( (*p)->opd[i] & BITS16 ) {
-- slen += sprintf(output+slen, "word ");
-+ slen += snprintf(output+slen, outbufsize-slen, "word ");
- } else if ( (*p)->opd[i] & BITS32 ) {
-- slen += sprintf(output+slen, "dword ");
-+ slen += snprintf(output+slen, outbufsize-slen, "dword ");
- } else if ( (*p)->opd[i] & NEAR ) {
-- slen += sprintf(output+slen, "near ");
-+ slen += snprintf(output+slen, outbufsize-slen, "near ");
- } else if ( (*p)->opd[i] & SHORT ) {
-- slen += sprintf(output+slen, "short ");
-+ slen += snprintf(output+slen, outbufsize-slen, "short ");
- }
-- slen += sprintf(output+slen, "0x%lx", ins.oprs[i].offset);
-+ slen += snprintf(output+slen, outbufsize-slen, "0x%lx", ins.oprs[i].offset);
- } else if ( !(MEM_OFFS & ~(*p)->opd[i]) ) {
-- slen += sprintf(output+slen, "[%s%s%s0x%lx]",
-+ slen += snprintf(output+slen, outbufsize-slen, "[%s%s%s0x%lx]",
- (segover ? segover : ""),
- (segover ? ":" : ""),
- (ins.oprs[i].addr_size == 32 ? "dword " :
-@@ -669,30 +676,30 @@
- } else if ( !(REGMEM & ~(*p)->opd[i]) ) {
- int started = FALSE;
- if ( (*p)->opd[i] & BITS8 )
-- slen += sprintf(output+slen, "byte ");
-+ slen += snprintf(output+slen, outbufsize-slen, "byte ");
- if ( (*p)->opd[i] & BITS16 )
-- slen += sprintf(output+slen, "word ");
-+ slen += snprintf(output+slen, outbufsize-slen, "word ");
- if ( (*p)->opd[i] & BITS32 )
-- slen += sprintf(output+slen, "dword ");
-+ slen += snprintf(output+slen, outbufsize-slen, "dword ");
- if ( (*p)->opd[i] & BITS64 )
-- slen += sprintf(output+slen, "qword ");
-+ slen += snprintf(output+slen, outbufsize-slen, "qword ");
- if ( (*p)->opd[i] & BITS80 )
-- slen += sprintf(output+slen, "tword ");
-+ slen += snprintf(output+slen, outbufsize-slen, "tword ");
- if ( (*p)->opd[i] & FAR )
-- slen += sprintf(output+slen, "far ");
-+ slen += snprintf(output+slen, outbufsize-slen, "far ");
- if ( (*p)->opd[i] & NEAR )
-- slen += sprintf(output+slen, "near ");
-+ slen += snprintf(output+slen, outbufsize-slen, "near ");
- output[slen++] = '[';
- if (ins.oprs[i].addr_size)
-- slen += sprintf(output+slen, "%s",
-+ slen += snprintf(output+slen, outbufsize-slen, "%s",
- (ins.oprs[i].addr_size == 32 ? "dword " :
- ins.oprs[i].addr_size == 16 ? "word " : ""));
- if (segover) {
-- slen += sprintf(output+slen, "%s:", segover);
-+ slen += snprintf(output+slen, outbufsize-slen, "%s:", segover);
- segover = NULL;
- }
- if (ins.oprs[i].basereg != -1) {
-- slen += sprintf(output+slen, "%s",
-+ slen += snprintf(output+slen, outbufsize-slen, "%s",
- reg_names[(ins.oprs[i].basereg -
- EXPR_REG_START)]);
- started = TRUE;
-@@ -700,11 +707,11 @@
- if (ins.oprs[i].indexreg != -1) {
- if (started)
- output[slen++] = '+';
-- slen += sprintf(output+slen, "%s",
-+ slen += snprintf(output+slen, outbufsize-slen, "%s",
- reg_names[(ins.oprs[i].indexreg -
- EXPR_REG_START)]);
- if (ins.oprs[i].scale > 1)
-- slen += sprintf(output+slen, "*%d", ins.oprs[i].scale);
-+ slen += snprintf(output+slen, outbufsize-slen, "*%d", ins.oprs[i].scale);
- started = TRUE;
- }
- if (ins.oprs[i].segment & SEG_DISP8) {
-@@ -713,20 +720,20 @@
- ins.oprs[i].offset = - (signed char) ins.oprs[i].offset;
- sign = '-';
- }
-- slen += sprintf(output+slen, "%c0x%lx", sign,
-+ slen += snprintf(output+slen, outbufsize-slen, "%c0x%lx", sign,
- ins.oprs[i].offset);
- } else if (ins.oprs[i].segment & SEG_DISP16) {
- if (started)
- output[slen++] = '+';
-- slen += sprintf(output+slen, "0x%lx", ins.oprs[i].offset);
-+ slen += snprintf(output+slen, outbufsize-slen, "0x%lx", ins.oprs[i].offset);
- } else if (ins.oprs[i].segment & SEG_DISP32) {
- if (started)
- output[slen++] = '+';
-- slen += sprintf(output+slen, "0x%lx", ins.oprs[i].offset);
-+ slen += snprintf(output+slen, outbufsize-slen, "0x%lx", ins.oprs[i].offset);
- }
- output[slen++] = ']';
- } else {
-- slen += sprintf(output+slen, "<operand%d>", i);
-+ slen += snprintf(output+slen, outbufsize-slen, "<operand%d>", i);
- }
- }
- output[slen] = '\0';
-@@ -741,8 +748,8 @@
- return length;
- }
-
--long eatbyte (unsigned char *data, char *output)
-+long eatbyte (unsigned char *data, char *output, int outbufsize)
- {
-- sprintf(output, "db 0x%02X", *data);
-+ snprintf(output, outbufsize, "db 0x%02X", *data);
- return 1;
- }
diff --git a/devel/nasm/files/patch-disasm.h b/devel/nasm/files/patch-disasm.h
deleted file mode 100644
index 3a1fd91bc294..000000000000
--- a/devel/nasm/files/patch-disasm.h
+++ /dev/null
@@ -1,17 +0,0 @@
-
-$FreeBSD$
-
---- disasm.h.orig
-+++ disasm.h
-@@ -11,8 +11,8 @@
-
- #define INSN_MAX 32 /* one instruction can't be longer than this */
-
--long disasm (unsigned char *data, char *output, int segsize, long offset,
-- int autosync, unsigned long prefer);
--long eatbyte (unsigned char *data, char *output);
-+long disasm (unsigned char *data, char *output, int outbufsize, int segsize,
-+ long offset, int autosync, unsigned long prefer);
-+long eatbyte (unsigned char *data, char *output, int outbufsize);
-
- #endif
diff --git a/devel/nasm/files/patch-labels.c b/devel/nasm/files/patch-labels.c
deleted file mode 100644
index 7f11aca39ad7..000000000000
--- a/devel/nasm/files/patch-labels.c
+++ /dev/null
@@ -1,23 +0,0 @@
-
-$FreeBSD$
-
---- labels.c.orig
-+++ labels.c
-@@ -221,7 +221,7 @@
- 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 @@
- 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);
diff --git a/devel/nasm/files/patch-listing.c b/devel/nasm/files/patch-listing.c
deleted file mode 100644
index f36d99db2a5f..000000000000
--- a/devel/nasm/files/patch-listing.c
+++ /dev/null
@@ -1,14 +0,0 @@
-
-$FreeBSD$
-
---- listing.c.orig
-+++ listing.c
-@@ -192,7 +192,7 @@
- else if (typ == OUT_RESERVE)
- {
- char q[20];
-- sprintf(q, "<res %08lX>", size);
-+ snprintf(q, sizeof(q), "<res %08lX>", size);
- list_out (offset, q);
- }
- }
diff --git a/devel/nasm/files/patch-nasm.c b/devel/nasm/files/patch-nasm.c
deleted file mode 100644
index fd1ac27c84f0..000000000000
--- a/devel/nasm/files/patch-nasm.c
+++ /dev/null
@@ -1,14 +0,0 @@
-
-$FreeBSD$
-
---- nasm.c.orig
-+++ nasm.c
-@@ -185,7 +185,7 @@
- /* define some macros dependent of command-line */
- {
- char temp [64];
-- sprintf (temp, "__OUTPUT_FORMAT__=%s\n", ofmt->shortname);
-+ snprintf (temp, sizeof(temp), "__OUTPUT_FORMAT__=%s\n", ofmt->shortname);
- pp_pre_define (temp);
- }
-
diff --git a/devel/nasm/files/patch-ndisasm.c b/devel/nasm/files/patch-ndisasm.c
deleted file mode 100644
index f714fb8c3c66..000000000000
--- a/devel/nasm/files/patch-ndisasm.c
+++ /dev/null
@@ -1,18 +0,0 @@
-
-$FreeBSD$
-
---- ndisasm.c.orig
-+++ ndisasm.c
-@@ -243,10 +243,10 @@
- nextsync = next_sync (offset, &synclen);
- }
- while (p > q && (p - q >= INSN_MAX || lenread == 0)) {
-- lendis = disasm (q, outbuf, bits, offset, autosync, prefer);
-+ lendis = disasm (q, outbuf, sizeof(outbuf), bits, offset, autosync, prefer);
- if (!lendis || lendis > (p - q) ||
- (unsigned long)lendis > nextsync-offset)
-- lendis = eatbyte (q, outbuf);
-+ lendis = eatbyte (q, outbuf, sizeof(outbuf));
- output_ins (offset, q, lendis, outbuf);
- q += lendis;
- offset += lendis;
diff --git a/devel/nasm/files/patch-output::outelf.c b/devel/nasm/files/patch-output::outelf.c
index df7073f8b1a1..58a9e0fe8ffd 100644
--- a/devel/nasm/files/patch-output::outelf.c
+++ b/devel/nasm/files/patch-output::outelf.c
@@ -1,11 +1,14 @@
---- output/outelf.c.orig Sun Dec 14 16:25:34 2003
-+++ output/outelf.c Sun Dec 14 16:26:25 2003
-@@ -1411,7 +1411,7 @@
- the source-file, the n_desc field should be set to the number
- of remaining stabs
- */
-- WRITE_STAB(sptr, fileidx[0], 0, 0, 0, strlen(allfiles[0]+12));
-+ WRITE_STAB(sptr, fileidx[0], 0, 0, 0, stabstrlen);
+
+$FreeBSD$
+
+--- output/outelf.c.orig
++++ output/outelf.c
+@@ -1431,7 +1431,7 @@
+ the source-file, the n_desc field should be set to the number
+ of remaining stabs
+ */
+- WRITE_STAB(sptr, fileidx[0], 0, 0, 0, strlen(allfiles[0] + 12));
++ WRITE_STAB(sptr, fileidx[0], 0, 0, 0, stabstrlen);
- ptr=stabslines;
- numstabs = 0;
+ ptr = stabslines;
+ numstabs = 0;
diff --git a/devel/nasm/files/patch-preproc.c b/devel/nasm/files/patch-preproc.c
deleted file mode 100644
index d75b4ccdb763..000000000000
--- a/devel/nasm/files/patch-preproc.c
+++ /dev/null
@@ -1,223 +0,0 @@
-
-$FreeBSD$
-
---- preproc.c.orig
-+++ preproc.c
-@@ -528,7 +528,7 @@
- fname++;
- fnlen = strcspn(fname, "\"");
- line = nasm_malloc(20 + fnlen);
-- sprintf(line, "%%line %d %.*s", lineno, fnlen, fname);
-+ snprintf(line, 20+fnlen,"%%line %d %.*s", lineno, fnlen, fname);
- nasm_free(oldline);
- }
- if (tasm_compatible_mode)
-@@ -833,6 +833,7 @@
- type = TOK_STRING;
- while (*p && *p != c)
- p++;
-+
- if (*p)
- {
- p++;
-@@ -840,6 +841,8 @@
- else
- {
- error(ERR_WARNING, "unterminated string");
-+ /* Handling unterminated strings by UNV */
-+ /* type = -1; */
- }
- }
- else if (isnumstart(*p))
-@@ -901,6 +904,15 @@
- }
- p++;
- }
-+
-+ /* Handling unterminated string by UNV */
-+ /*if (type == -1)
-+ {
-+ *tail = t = new_Token(NULL, TOK_STRING, line, p-line+1);
-+ t->text[p-line] = *line;
-+ tail = &t->next;
-+ }
-+ else*/
- if (type != TOK_COMMENT)
- {
- *tail = t = new_Token(NULL, type, line, p - line);
-@@ -919,20 +931,20 @@
- static void *
- new_Block(size_t size)
- {
-- Blocks *b = &blocks;
-+ Blocks *b = &blocks;
-
-- /* first, get to the end of the linked list */
-- while (b->next)
-- b = b->next;
-- /* now allocate the requested chunk */
-- b->chunk = nasm_malloc(size);
-+ /* first, get to the end of the linked list */
-+ while (b->next)
-+ b = b->next;
-+ /* now allocate the requested chunk */
-+ b->chunk = nasm_malloc(size);
-
-- /* now allocate a new block for the next request */
-- b->next = nasm_malloc(sizeof(Blocks));
-- /* and initialize the contents of the new block */
-- b->next->next = NULL;
-- b->next->chunk = NULL;
-- return b->chunk;
-+ /* now allocate a new block for the next request */
-+ b->next = nasm_malloc(sizeof(Blocks));
-+ /* and initialize the contents of the new block */
-+ b->next->next = NULL;
-+ b->next->chunk = NULL;
-+ return b->chunk;
- }
-
- /*
-@@ -941,22 +953,22 @@
- static void
- delete_Blocks(void)
- {
-- Blocks *a,*b = &blocks;
-+ Blocks *a,*b = &blocks;
-
-- /*
-- * keep in mind that the first block, pointed to by blocks
-- * is a static and not dynamically allocated, so we don't
-- * free it.
-- */
-- while (b)
-- {
-- if (b->chunk)
-- nasm_free(b->chunk);
-- a = b;
-- b = b->next;
-- if (a != &blocks)
-- nasm_free(a);
-- }
-+ /*
-+ * keep in mind that the first block, pointed to by blocks
-+ * is a static and not dynamically allocated, so we don't
-+ * free it.
-+ */
-+ while (b)
-+ {
-+ if (b->chunk)
-+ nasm_free(b->chunk);
-+ a = b;
-+ b = b->next;
-+ if (a != &blocks)
-+ nasm_free(a);
-+ }
- }
-
- /*
-@@ -1043,7 +1055,7 @@
- char *p, *q = t->text + 2;
-
- q += strspn(q, "$");
-- sprintf(buffer, "..@%lu.", ctx->number);
-+ snprintf(buffer, sizeof(buffer), "..@%lu.", ctx->number);
- p = nasm_strcat(buffer, q);
- nasm_free(t->text);
- t->text = p;
-@@ -1520,23 +1532,30 @@
- t = t->next;
- continue;
- }
-- else if (tt->type == TOK_WHITESPACE)
-+ if (tt->type == TOK_WHITESPACE)
- {
- tt = tt->next;
- continue;
- }
-- else if (tt->type != t->type ||
-- mstrcmp(tt->text, t->text, casesense))
-+ if (tt->type != t->type)
- {
- j = FALSE; /* found mismatching tokens */
- break;
- }
-- else
-+ /* Unify surrounding quotes for strings */
-+ if (t->type == TOK_STRING)
- {
-- t = t->next;
-- tt = tt->next;
-- continue;
-+ tt->text[0] = t->text[0];
-+ tt->text[strlen(tt->text) - 1] = t->text[0];
- }
-+ if (mstrcmp(tt->text, t->text, casesense) != 0)
-+ {
-+ j = FALSE; /* found mismatching tokens */
-+ break;
-+ }
-+
-+ t = t->next;
-+ tt = tt->next;
- }
- if ((t->type != TOK_OTHER || strcmp(t->text, ",")) || tt)
- j = FALSE; /* trailing gunk on one end or other */
-@@ -1954,7 +1973,7 @@
- free_tlist(tt);
-
- /* Now define the macro for the argument */
-- sprintf(directive, "%%define %s (%s+%d)", arg, StackPointer,
-+ snprintf(directive, sizeof(directive), "%%define %s (%s+%d)", arg, StackPointer,
- offset);
- do_directive(tokenise(directive));
- offset += size;
-@@ -2051,13 +2070,13 @@
- free_tlist(tt);
-
- /* Now define the macro for the argument */
-- sprintf(directive, "%%define %s (%s-%d)", local, StackPointer,
-+ snprintf(directive, sizeof(directive), "%%define %s (%s-%d)", local, StackPointer,
- offset);
- do_directive(tokenise(directive));
- offset += size;
-
- /* Now define the assign to setup the enter_c macro correctly */
-- sprintf(directive, "%%assign %%$localsize %%$localsize+%d",
-+ snprintf(directive, sizeof(directive), "%%assign %%$localsize %%$localsize+%d",
- size);
- do_directive(tokenise(directive));
-
-@@ -3182,12 +3201,12 @@
- */
- case '0':
- type = TOK_NUMBER;
-- sprintf(tmpbuf, "%d", mac->nparam);
-+ snprintf(tmpbuf, sizeof(tmpbuf), "%d", mac->nparam);
- text = nasm_strdup(tmpbuf);
- break;
- case '%':
- type = TOK_ID;
-- sprintf(tmpbuf, "..@%lu.", mac->unique);
-+ snprintf(tmpbuf, sizeof(tmpbuf), "..@%lu.", mac->unique);
- text = nasm_strcat(tmpbuf, t->text + 2);
- break;
- case '-':
-@@ -4067,7 +4086,7 @@
- return;
-
- va_start(arg, fmt);
-- vsprintf(buff, fmt, arg);
-+ vsnprintf(buff, sizeof(buff), fmt, arg);
- va_end(arg);
-
- if (istk && istk->mstk && istk->mstk->name)
-@@ -4530,7 +4549,7 @@
- make_tok_num(Token * tok, long val)
- {
- char numbuf[20];
-- sprintf(numbuf, "%ld", val);
-+ snprintf(numbuf, sizeof(numbuf), "%ld", val);
- tok->text = nasm_strdup(numbuf);
- tok->type = TOK_NUMBER;
- }