Skip to content
Snippets Groups Projects
Commit 76b33edd authored by deuce's avatar deuce
Browse files

Use memcpy() rather than str*cpy() since the buffer size is known and we

don't actually need the terminating NULL.  Still terminate prefix though to
be nice.
parent 422e4e9c
No related branches found
No related tags found
No related merge requests found
...@@ -781,7 +781,7 @@ js_word_wrap(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) ...@@ -781,7 +781,7 @@ js_word_wrap(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
/* Terminate prefix */ /* Terminate prefix */
prefix[prefix_bytes]=0; prefix[prefix_bytes]=0;
} }
strncpy(linebuf,prefix,prefix_bytes); memcpy(linebuf,prefix,prefix_bytes);
l=prefix_bytes; l=prefix_bytes;
ocol=prefix_len+1; ocol=prefix_len+1;
icol=prefix_len+1; icol=prefix_len+1;
...@@ -827,7 +827,7 @@ js_word_wrap(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) ...@@ -827,7 +827,7 @@ js_word_wrap(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
linebuf[l++]='\r'; linebuf[l++]='\r';
linebuf[l++]='\n'; linebuf[l++]='\n';
outbuf_append(&outbuf, &outp, linebuf, l, &outbuf_size); outbuf_append(&outbuf, &outp, linebuf, l, &outbuf_size);
strncpy(linebuf,prefix,prefix_bytes); memcpy(linebuf,prefix,prefix_bytes);
l=prefix_bytes; l=prefix_bytes;
ocol=prefix_len+1; ocol=prefix_len+1;
old_prefix_bytes=prefix_bytes; old_prefix_bytes=prefix_bytes;
...@@ -848,7 +848,7 @@ js_word_wrap(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) ...@@ -848,7 +848,7 @@ js_word_wrap(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
linebuf[l++]='\n'; linebuf[l++]='\n';
outbuf_append(&outbuf, &outp, linebuf, l, &outbuf_size); outbuf_append(&outbuf, &outp, linebuf, l, &outbuf_size);
if(prefix) if(prefix)
strcpy(linebuf,prefix); memcpy(linebuf,prefix,prefix_bytes);
l=prefix_bytes; l=prefix_bytes;
ocol=prefix_len+1; ocol=prefix_len+1;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment