Skip to content

Instantly share code, notes, and snippets.

@srepmub
Created February 13, 2017 09:50
Show Gist options
  • Save srepmub/a065ae74131512a2fe2af6af786667b2 to your computer and use it in GitHub Desktop.
Save srepmub/a065ae74131512a2fe2af6af786667b2 to your computer and use it in GitHub Desktop.
swig_coverity_fixmethods.patch
diff --git a/Lib/python/pyinit.swg b/Lib/python/pyinit.swg
index 2cc582841..fe45ac941 100644
--- a/Lib/python/pyinit.swg
+++ b/Lib/python/pyinit.swg
@@ -306,9 +306,9 @@ SWIG_Python_FixMethods(PyMethodDef *methods,
char *ndoc = (char*)malloc(ldoc + lptr + 10);
if (ndoc) {
char *buff = ndoc;
- strncpy(buff, methods[i].ml_doc, ldoc);
+ memcpy(buff, methods[i].ml_doc, ldoc);
buff += ldoc;
- strncpy(buff, "swig_ptr: ", 10);
+ memcpy(buff, "swig_ptr: ", 10);
buff += 10;
SWIG_PackVoidPtr(buff, ptr, ty->name, lptr);
methods[i].ml_doc = ndoc;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment