ALT Linux Bugzilla
– Attachment 2070 Details for
Bug 12135
Падает scrollkeeper-update при неправильном состоянии каталогов
New bug
|
Search
|
[?]
|
Help
Register
|
Log In
[x]
|
Forgot Password
Login:
[x]
|
EN
|
RU
[patch]
Respect the path length in strncat's
scrollkeeper-0.3.14-fix-overflows.patch (text/plain), 3.19 KB, created by
Alexey Rusakov
on 2007-06-30 21:53:09 MSD
(
hide
)
Description:
Respect the path length in strncat's
Filename:
MIME Type:
Creator:
Alexey Rusakov
Created:
2007-06-30 21:53:09 MSD
Size:
3.19 KB
patch
obsolete
>diff -upk.orig scrollkeeper-0.3.14.orig/libs/database.c scrollkeeper-0.3.14/libs/database.c >--- scrollkeeper-0.3.14.orig/libs/database.c 2002-06-02 06:03:10 +0000 >+++ scrollkeeper-0.3.14/libs/database.c 2007-06-26 12:34:52 +0000 >@@ -17,6 +17,7 @@ > */ > > #include <config.h> >+#include <limits.h> > #include <stdlib.h> > #include <string.h> > #include <stddef.h> >@@ -27,9 +28,6 @@ > #include <dirent.h> > #include <scrollkeeper.h> > >-#define PATHLEN 256 >- >- > /* > * Create a directory. Send errors to appropriate places (STDOUT and log > * file) according to command-line flags. >@@ -55,7 +53,7 @@ static int sk_mkdir(char *path, mode_t o > */ > int sk_mkdir_with_parents(char *fullpath, mode_t options, char outputprefs) > { >- char path[1024]; >+ char path[PATH_MAX]; > char slash[]="/"; > char delim[]="/"; > char *token, *pathcopy; >@@ -63,15 +61,17 @@ int sk_mkdir_with_parents(char *fullpath > > pathcopy = strdup(fullpath); /* Copy b/c strtok edits the string it operates on */ > path[0] = '\0'; /* Initialize with end of string null character */ >- if (pathcopy[0] == slash[0]) sprintf(path, "/"); /* preserve any starting slash */ >+ if (pathcopy[0] == slash[0]) strcpy(path, "/"); /* preserve any starting slash */ > > token = strtok (pathcopy, delim); > delim[0]=slash[0]; > while(token != NULL) { >+ const int path_len = strlen(path); > if (strlen(path) == 0 || ((strlen(path) == 1) && (path[0] == slash[0]))) { >- sprintf(path, "%s%s", path, token); >+ strncat(path, token, sizeof(path) - path_len - 1); > } else { >- sprintf(path, "%s/%s", path, token); >+ strncat(path, "/", sizeof(path) - path_len - 1); >+ strncat(path, token, sizeof(path) - path_len - 2); > } > if (stat(path, &buf) == -1) { > if (sk_mkdir(path, options, outputprefs) != 0) { >diff -upk.orig scrollkeeper-0.3.14.orig/libs/install.c scrollkeeper-0.3.14/libs/install.c >--- scrollkeeper-0.3.14.orig/libs/install.c 2003-09-03 10:33:52 +0000 >+++ scrollkeeper-0.3.14/libs/install.c 2007-06-26 12:34:11 +0000 >@@ -32,7 +32,6 @@ > #define _(String) gettext (String) > > #define SEP "|" >-#define PATHLEN 256 > > #ifdef SOLARIS > /*extern char *strtok_r(char *, const char *, char **);*/ >diff -upk.orig scrollkeeper-0.3.14.orig/libs/scrollkeeper.h.in scrollkeeper-0.3.14/libs/scrollkeeper.h.in >--- scrollkeeper-0.3.14.orig/libs/scrollkeeper.h.in 2003-06-23 09:00:44 +0000 >+++ scrollkeeper-0.3.14/libs/scrollkeeper.h.in 2007-06-26 12:34:11 +0000 >@@ -32,7 +32,8 @@ > #define SCROLLKEEPERLOGFILE "@localstatedir@/log/scrollkeeper.log" > #define SCROLLKEEPERLOGFILE_ROT "@localstatedir@/log/scrollkeeper.log.1" > #define SCROLLKEEPER_OMF_DTD "@prefix@/share/xml/scrollkeeper/dtds/scrollkeeper-omf.dtd" >-#define PATHLEN 256 >+#include <limits.h> >+#define PATHLEN PATH_MAX > > /* > * >diff -upk.orig scrollkeeper-0.3.14.orig/libs/uninstall.c scrollkeeper-0.3.14/libs/uninstall.c >--- scrollkeeper-0.3.14.orig/libs/uninstall.c 2003-12-02 08:09:56 +0000 >+++ scrollkeeper-0.3.14/libs/uninstall.c 2007-06-26 12:34:11 +0000 >@@ -29,8 +29,6 @@ > > #define _(String) gettext (String) > >-#define PATHLEN 256 >- > struct IdTab { > int id; > char *locale;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 12135
:
2040
|
2041
|
2042
|
2044
|
2045
|
2047
|
2052
|
2062
|
2063
|
2065
| 2070