ps/sortformat.c: Handle large width in aix_format_parse().
Unlikely to ever happen, since it would imply a very large string, but better safe than sorry.
This commit is contained in:
parent
cde22815af
commit
bb89dad867
@ -22,6 +22,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
@ -172,7 +173,7 @@ static const char *aix_format_parse(sf_node *sfn){
|
|||||||
return _("AIX field descriptor processing bug");
|
return _("AIX field descriptor processing bug");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int len;
|
size_t len;
|
||||||
len = strcspn(walk, "%");
|
len = strcspn(walk, "%");
|
||||||
memcpy(buf,walk,len);
|
memcpy(buf,walk,len);
|
||||||
if(0){
|
if(0){
|
||||||
@ -183,7 +184,7 @@ double_percent:
|
|||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
walk += len;
|
walk += len;
|
||||||
fnode = malloc(sizeof(format_node));
|
fnode = malloc(sizeof(format_node));
|
||||||
fnode->width = len;
|
fnode->width = len < INT_MAX ? len : INT_MAX;
|
||||||
fnode->name = strdup(buf);
|
fnode->name = strdup(buf);
|
||||||
fnode->pr = NULL; /* checked for */
|
fnode->pr = NULL; /* checked for */
|
||||||
fnode->need = 0;
|
fnode->need = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user