for (i = 0; i < npvs; i++) {
if (pvs[i].sizeOut < 0) {
char buf[32];
- sprintf(buf, "problem with param %d", i);
+ PyOS_snprintf(buf, sizeof(buf),
+ "problem with param %d", i);
PyErr_SetString(ErrorObject, buf);
goto error;
}
x = i + strlen(s3) + strlen(cmdstring) + 1;
s2 = (char *)_alloca(x);
ZeroMemory(s2, x);
- sprintf(s2, "%s%s%s", s1, s3, cmdstring);
+ PyOS_snprintf(s2, x, "%s%s%s", s1, s3, cmdstring);
}
else {
/*
s2 = (char *)_alloca(x);
ZeroMemory(s2, x);
- sprintf(
- s2,
+ PyOS_snprintf(
+ s2, x,
"%s \"%s%s%s\"",
modulepath,
s1,
return 1; /* Indicate Success */
}
- sprintf(reason, "OS/2 TCP/IP Error# %d", sock_errno());
+ PyOS_snprintf(reason, sizeof(reason),
+ "OS/2 TCP/IP Error# %d", sock_errno());
PyErr_SetString(PyExc_ImportError, reason);
return 0; /* Indicate Failure */
return NULL;
}
else if (errno != 0) {
- sprintf(buffer, "atoi() literal too large: %.200s", s);
+ PyOS_snprintf(buffer, sizeof(buffer),
+ "atoi() literal too large: %.200s", s);
PyErr_SetString(PyExc_ValueError, buffer);
return NULL;
}
while (*end && isspace(Py_CHARMASK(*end)))
end++;
if (*end != '\0') {
- sprintf(buffer, "invalid literal for atol(): %.200s", s);
+ PyOS_snprintf(buffer, sizeof(buffer),
+ "invalid literal for atol(): %.200s", s);
PyErr_SetString(PyExc_ValueError, buffer);
Py_DECREF(x);
return NULL;
/* We are so very thread-safe... */
this_thread = atomic_add( &thread_count, 1 );
- sprintf( name, "python thread (%d)", this_thread );
+ PyOS_snprintf(name, sizeof(name),
+ "python thread (%d)", this_thread );
tid = spawn_thread( (thread_func)func, name,
B_NORMAL_PRIORITY, arg );
}
this_lock = atomic_add( &lock_count, 1 );
- sprintf( name, "python lock (%d)", this_lock );
+ PyOS_snprintf(name, sizeof(name), "python lock (%d)", this_lock);
retval = benaphore_create( name, lock );
if( retval != EOK ) {