From f9a15ce1a69f905e94db7650f0a4805720cd9c88 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sun, 8 Apr 2001 20:22:39 +0000 Subject: Got "medieval on our ass" about adding the -1 to slprintf. Jeremy. (This used to be commit 94747b4639ed9b19f7d0fb896e43aa392a84989a) --- source3/lib/charset.c | 2 +- source3/lib/messages.c | 2 +- source3/lib/substitute.c | 2 +- source3/lib/util.c | 2 +- source3/lib/util_str.c | 2 +- source3/lib/util_unistr.c | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) (limited to 'source3/lib') diff --git a/source3/lib/charset.c b/source3/lib/charset.c index fcaca79b88..d699df3e2b 100644 --- a/source3/lib/charset.c +++ b/source3/lib/charset.c @@ -205,7 +205,7 @@ static codepage_p load_client_codepage( int client_codepage ) pstrcat(codepage_file_name, "/"); pstrcat(codepage_file_name, "codepage."); slprintf(&codepage_file_name[strlen(codepage_file_name)], - sizeof(pstring)-(strlen(codepage_file_name)+1), + sizeof(pstring)-(strlen(codepage_file_name)+1)-1, "%03d", client_codepage); diff --git a/source3/lib/messages.c b/source3/lib/messages.c index ab02d1253b..5591f141cc 100644 --- a/source3/lib/messages.c +++ b/source3/lib/messages.c @@ -115,7 +115,7 @@ static TDB_DATA message_key_pid(pid_t pid) static char key[20]; TDB_DATA kbuf; - slprintf(key, sizeof(key), "PID/%d", (int)pid); + slprintf(key, sizeof(key)-1, "PID/%d", (int)pid); kbuf.dptr = (char *)key; kbuf.dsize = strlen(key)+1; diff --git a/source3/lib/substitute.c b/source3/lib/substitute.c index c4bd1377c2..6abdeea114 100644 --- a/source3/lib/substitute.c +++ b/source3/lib/substitute.c @@ -182,7 +182,7 @@ void standard_sub_basic(char *str) case 'T' : string_sub(p,"%T", timestring(False),l); break; case 'a' : string_sub(p,"%a", remote_arch,l); break; case 'd' : - slprintf(pidstr,sizeof(pidstr), "%d",(int)sys_getpid()); + slprintf(pidstr,sizeof(pidstr)-1, "%d",(int)sys_getpid()); string_sub(p,"%d", pidstr,l); break; case 'h' : string_sub(p,"%h", myhostname(),l); break; diff --git a/source3/lib/util.c b/source3/lib/util.c index 2b7cfabf8e..439788bdac 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -1875,7 +1875,7 @@ int _Insure_trap_error(int a1, int a2, int a3, int a4, int a5, int a6) char pidstr[10]; pstring cmd = "/usr/X11R6/bin/xterm -display :0 -T Panic -n Panic -e /bin/sh -c 'cat /tmp/ierrs.*.%d ; gdb /proc/%d/exe %d'"; - slprintf(pidstr, sizeof(pidstr), "%d", sys_getpid()); + slprintf(pidstr, sizeof(pidstr)-1, "%d", sys_getpid()); pstring_sub(cmd, "%d", pidstr); if (!fn) { diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index e07e5ef6ad..03ad5a66b0 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -1262,7 +1262,7 @@ char *octal_string(int i) if (i == -1) { return "-1"; } - slprintf(ret, sizeof(ret), "0%o", i); + slprintf(ret, sizeof(ret)-1, "0%o", i); return ret; } diff --git a/source3/lib/util_unistr.c b/source3/lib/util_unistr.c index 3ab4bdca9f..18f3b54bf7 100644 --- a/source3/lib/util_unistr.c +++ b/source3/lib/util_unistr.c @@ -1960,9 +1960,9 @@ smb_ucs2_t *octal_string_w(int i) char ret[64]; if (i == -1) - slprintf(ret, sizeof(ret), "-1"); + slprintf(ret, sizeof(ret)-1, "-1"); else - slprintf(ret, sizeof(ret), "0%o", i); + slprintf(ret, sizeof(ret)-1, "0%o", i); return unix_to_unicode(wret, ret, sizeof(wret)); } -- cgit