]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
More sprintf -> PyOS_snprintf.
authorTim Peters <tim.peters@gmail.com>
Wed, 28 Nov 2001 22:07:30 +0000 (22:07 +0000)
committerTim Peters <tim.peters@gmail.com>
Wed, 28 Nov 2001 22:07:30 +0000 (22:07 +0000)
Modules/almodule.c
Modules/posixmodule.c
Modules/socketmodule.c
Modules/stropmodule.c
Python/thread_beos.h

index 9e26081cb0cf90e48a2f591415afa23eb978ba06..e9b2114695f27dd2912240a0c78cff3c26771fc6 100644 (file)
@@ -1519,7 +1519,8 @@ al_GetParams(PyObject *self, PyObject *args)
        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;
                }
index 33401317625461c5f3659e9b6d492d7c0b1f7b53..37c0f86a78671073c5d3489daa4e303ecabf23a8 100644 (file)
@@ -2555,7 +2555,7 @@ _PyPopenCreateProcess(char *cmdstring,
                        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 {
                        /*
@@ -2608,8 +2608,8 @@ _PyPopenCreateProcess(char *cmdstring,
 
                        s2 = (char *)_alloca(x);
                        ZeroMemory(s2, x);
-                       sprintf(
-                               s2,
+                       PyOS_snprintf(
+                               s2, x,
                                "%s \"%s%s%s\"",
                                modulepath,
                                s1,
index eccee4d3f4ab23cef041b3125827553281dbc481..db91d8b99411774ee13b57ca99b12a87c85c8093 100644 (file)
@@ -3089,7 +3089,8 @@ OS2init(void)
            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 */
index 3c5de2b471e1babe287a87f70b97341c5f21bcb7..54d444f188bde760744a50b457ab4dc17eaccbef 100644 (file)
@@ -778,7 +778,8 @@ strop_atoi(PyObject *self, PyObject *args)
                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;
        }
@@ -828,7 +829,8 @@ strop_atol(PyObject *self, PyObject *args)
        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;
index 3f843474bffaa6d489ea58909f1d104dd0edbbb6..74eab2e912b0ec96697aadd9085dade54d253ef1 100644 (file)
@@ -123,7 +123,8 @@ long PyThread_start_new_thread( void (*func)(void *), void *arg )
 
        /* 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 );
@@ -222,7 +223,7 @@ PyThread_type_lock PyThread_allocate_lock( void )
        }
 
        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 ) {